Skip to content

Commit

Permalink
Per #269, updated the messaging in 'xportr_order()` to fix a mistatem…
Browse files Browse the repository at this point in the history
…ent.

The function is concerned about if variables in the dataset aren't in the specifiation file, not the other way around.
  • Loading branch information
elimillera committed Nov 26, 2024
1 parent fc52f00 commit a6d7bdf
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# xportr (development version)

* Updated order messaging to clarify some messaging when all data in dataset is
found in the specification. (#269)

* `"hms"` was added to the default value of the `xportr.numeric_types` option.
This ensures that `{xportr}` works smoothly with variables created by
`admiral::derive_vars_dtm_to_tm()`. (#271)
Expand Down
2 changes: 1 addition & 1 deletion R/messages.R
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ var_ord_msg <- function(reordered_vars, moved_vars, verbose) {
)
xportr_logger(message, verbose)
} else {
cli_h2("All variables in specification file are in dataset")
cli_h2("All variables in dataset are found in `metadata`")
}

if (length(reordered_vars) > 0) {
Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/test-order.R
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ test_that("order Test 8: Variable ordering messaging is correct", {
local_cli_theme()
suppressMessages(
xportr_order(df, df_meta, verbose = "message", domain = "df") %>%
expect_message("All variables in specification file are in dataset") %>%
expect_message("All variables in dataset are found in `metadata`") %>%
expect_condition("4 reordered in dataset") %>%
expect_message("Variable reordered in `.df`: `a`, `b`, `c`, and `d`")
)
Expand Down Expand Up @@ -172,13 +172,13 @@ test_that("order Test 10: Gets warning when metadata has multiple rows with same
# Checks that message appears when xportr.domain_name is invalid
suppressMessages(multiple_vars_in_spec_helper(xportr_order) %>%
# expect_message() are being caught to provide clean test without output #nolint
expect_message("All variables in specification file are in dataset") %>%
expect_message("All variables in dataset are found in `metadata`") %>%
expect_message("All variables in dataset are ordered"))

# Checks that message doesn't appear when xportr.domain_name is valid
suppressMessages(multiple_vars_in_spec_helper2(xportr_order) %>%
# expect_message() are being caught to provide clean test without output #nolint
expect_message("All variables in specification file are in dataset") %>%
expect_message("All variables in dataset are found in `metadata`") %>%
expect_message("All variables in dataset are ordered"))
})

Expand Down

0 comments on commit a6d7bdf

Please sign in to comment.