Skip to content

Commit

Permalink
added snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
ddsjoberg committed Apr 11, 2024
1 parent 9fb9947 commit 11fbc94
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
9 changes: 9 additions & 0 deletions tests/testthat/_snaps/assertions.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,15 @@
! List element "val" must be `>=0` in argument `input`:
i But, `input[[2]]$val = -1`, and `input[[3]]$val = -2`

# assert_one_to_one Test 84: error if there is a one to many mapping

Code
assert_one_to_one(pharmaversesdtm::dm, exprs(DOMAIN), exprs(USUBJID))
Condition
Error:
! For some values of "DOMAIN" there is more than one value of "USUBJID"
i Call `get_one_to_many_dataset()` to get all one-to-many values.

# assert_date_var Test 86: error if variable is not a date or datetime variable

Code
Expand Down
10 changes: 9 additions & 1 deletion tests/testthat/test-assertions.R
Original file line number Diff line number Diff line change
Expand Up @@ -1268,6 +1268,13 @@ test_that("assert_list_element Test 83: error if the elements do not fulfill the
## Test 84: error if there is a one to many mapping ----
test_that("assert_one_to_one Test 84: error if there is a one to many mapping", {
expect_error(
assert_one_to_one(pharmaversesdtm::dm, exprs(DOMAIN), exprs(USUBJID)),
class = "assert_one_to_one"
)
admiraldev_environment$one_to_many <- NULL

expect_snapshot(
error = TRUE,
assert_one_to_one(pharmaversesdtm::dm, exprs(DOMAIN), exprs(USUBJID))
)
admiraldev_environment$one_to_many <- NULL
Expand All @@ -1276,7 +1283,8 @@ test_that("assert_one_to_one Test 84: error if there is a one to many mapping",
## Test 85: error if there is a many to one mapping ----
test_that("assert_one_to_one Test 85: error if there is a many to one mapping", {
expect_error(
assert_one_to_one(pharmaversesdtm::dm, exprs(USUBJID), exprs(DOMAIN))
assert_one_to_one(pharmaversesdtm::dm, exprs(USUBJID), exprs(DOMAIN)),
class = "assert_one_to_one"
)
admiraldev_environment$many_to_one <- NULL
})
Expand Down

0 comments on commit 11fbc94

Please sign in to comment.