Skip to content

Commit

Permalink
Add new messages test
Browse files Browse the repository at this point in the history
  • Loading branch information
elimillera committed Dec 24, 2024
1 parent 92fea6b commit 631e7fd
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/testthat/test-messages.R
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,22 @@ test_that("messages Test 5: No domain messages are shown", {
log_no_domain("adsl", "domains", "message") %>%
expect_message("Domain not found in metadata.") %>%
expect_message("Domain 'adsl' not found in metadata 'domains' column.")

adsl <- data.frame(
USUBJID = c(1001, 1002, 1003),
BRTHDT = c(1, 1, 2)
)

metadata <- data.frame(
dataset = c("adsl", "adsl"),
variable = c("USUBJID", "BRTHDT"),
order = c(1, 2)
)

xportr_order(adsl, metadata, "wrong_adsl", verbose = "message") %>%
expect_message("Domain not found in metadata.") %>%
expect_message("Domain 'wrong_adsl' not found in metadata 'dataset' column.") %>%
expect_message("2 variables not in spec and moved to end") %>%
expect_message("Variable moved to end in `.df`: `USUBJID` and `BRTHDT`") %>%
expect_message("All variables in dataset are ordered")
})

0 comments on commit 631e7fd

Please sign in to comment.