Skip to content

Commit

Permalink
test: Fix test (#846)
Browse files Browse the repository at this point in the history
  • Loading branch information
krlmlr authored Dec 1, 2024
1 parent 28b8f09 commit 9854631
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
8 changes: 4 additions & 4 deletions tests/testthat/_snaps/bump_version.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
Code
bump_version(no_change_behavior = "fail")
Message
> Digesting messages from 2 commits.
> Digesting messages from 1 commits.
Condition
Error in `bump_version_impl()`:
x No change since last version.
Expand All @@ -102,16 +102,16 @@
Code
bump_version(no_change_behavior = "noop")
Message
> Digesting messages from 2 commits.
> Digesting messages from 1 commits.
i No change since last version.

---

Code
bump_version(no_change_behavior = "bump")
Message
> Digesting messages from 2 commits.
i Internal changes only.
> Digesting messages from 1 commits.
i Same as previous version.
-- Updating NEWS --
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/_snaps/bump_version/NEWS3.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# tea 0.0.0.9002

- Internal changes only.
- Same as previous version.


# tea 0.0.0.9001
Expand Down
11 changes: 9 additions & 2 deletions tests/testthat/test-bump_version.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ test_that("bump_version() works -- dev", {

expect_equal(as.character(desc::desc_get_version()), "0.0.0.9000")

expect_snapshot(bump_version())
expect_snapshot({
bump_version()
})

expect_equal(as.character(desc::desc_get_version()), "0.0.0.9001")
expect_equal(get_last_version_tag()[["name"]], "v0.0.0.9001")
Expand Down Expand Up @@ -38,6 +40,9 @@ test_that("bump_version() works -- dev", {
test_that("bump_version() works -- dev squash", {
local_demo_project(quiet = TRUE)

# Important for the squash to actually create a different commit
gert::git_config_set("merge.ff", "false")

tempdir_remote <- withr::local_tempdir(pattern = "remote")
create_remote(tempdir_remote)

Expand All @@ -49,7 +54,9 @@ test_that("bump_version() works -- dev squash", {

gert::git_branch_create("fledge")

expect_snapshot(bump_version(check_default_branch = FALSE))
expect_snapshot({
bump_version(check_default_branch = FALSE)
})

gert::git_branch_checkout("main")
gert::git_merge("fledge", squash = TRUE)
Expand Down

0 comments on commit 9854631

Please sign in to comment.