From a6d7bdf3f70f02f8afb21b7c440f518af7e0766b Mon Sep 17 00:00:00 2001 From: Eli Miller Date: Mon, 25 Nov 2024 20:08:43 -0600 Subject: [PATCH] Per #269, updated the messaging in 'xportr_order()` to fix a mistatement. The function is concerned about if variables in the dataset aren't in the specifiation file, not the other way around. --- NEWS.md | 3 +++ R/messages.R | 2 +- tests/testthat/test-order.R | 6 +++--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/NEWS.md b/NEWS.md index 9e1c4ce4..edb7c129 100644 --- a/NEWS.md +++ b/NEWS.md @@ -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) diff --git a/R/messages.R b/R/messages.R index 3ab774ef..89dd77e3 100644 --- a/R/messages.R +++ b/R/messages.R @@ -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) { diff --git a/tests/testthat/test-order.R b/tests/testthat/test-order.R index 8aaa4dc6..6368af3e 100644 --- a/tests/testthat/test-order.R +++ b/tests/testthat/test-order.R @@ -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`") ) @@ -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")) })