Skip to content

Commit

Permalink
use snapshot tests
Browse files Browse the repository at this point in the history
  • Loading branch information
teunbrand committed Oct 21, 2024
1 parent 42b92c1 commit de5eaa8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
16 changes: 16 additions & 0 deletions tests/testthat/_snaps/breaks-log.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# minor_breaks_log rejects invalid arguments

Code
minor_breaks_log(7)
Condition
Error in `minor_breaks_log()`:
! The `detail` argument must be one of 1, 5 or 10.

---

Code
minor_breaks_log(smallest = 0)
Condition
Error in `minor_breaks_log()`:
! The `smallest` argument must be a finite, positive, non-zero number.

10 changes: 2 additions & 8 deletions tests/testthat/test-breaks-log.R
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,6 @@ test_that("minor_breaks_log has correct amount of detail", {
})

test_that("minor_breaks_log rejects invalid arguments", {
expect_error(
minor_breaks_log(7),
"must be one of 1, 5 or 10"
)
expect_error(
minor_breaks_log(smallest = 0),
"must be a finite, positive, non-zero number."
)
expect_snapshot(minor_breaks_log(7), error = TRUE)
expect_snapshot(minor_breaks_log(smallest = 0), error = TRUE)
})

0 comments on commit de5eaa8

Please sign in to comment.