Skip to content

Commit 256499f

Browse files
committed
fix: replace snapshot tests with regex, update NAMESPACE
1 parent 6290957 commit 256499f

4 files changed

Lines changed: 71 additions & 97 deletions

File tree

NAMESPACE

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ export(ds.setDefaultOpals)
105105
export(ds.setSeed)
106106
export(ds.skewness)
107107
export(ds.sqrt)
108+
export(ds.standardiseDf)
108109
export(ds.subset)
109110
export(ds.subsetByClass)
110111
export(ds.summary)
@@ -121,6 +122,24 @@ export(ds.vectorCalc)
121122
export(subsetHelper)
122123
import(DSI)
123124
import(data.table)
125+
import(dplyr)
126+
importFrom(DSI,datashield.aggregate)
127+
importFrom(DSI,datashield.assign)
128+
importFrom(assertthat,assert_that)
129+
importFrom(cli,cli_abort)
130+
importFrom(cli,cli_alert_danger)
131+
importFrom(cli,cli_alert_info)
132+
importFrom(cli,cli_alert_success)
133+
importFrom(cli,cli_alert_warning)
134+
importFrom(cli,cli_end)
135+
importFrom(cli,cli_li)
136+
importFrom(cli,cli_ol)
137+
importFrom(cli,cli_text)
138+
importFrom(cli,cli_ul)
139+
importFrom(purrr,map)
140+
importFrom(purrr,map_lgl)
141+
importFrom(purrr,pmap)
142+
importFrom(purrr,pmap_lgl)
124143
importFrom(stats,as.formula)
125144
importFrom(stats,na.omit)
126145
importFrom(stats,ts)

man/ds.standardiseDf.Rd

Lines changed: 37 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/_snaps/smk-standardiseDf.md

Lines changed: 0 additions & 86 deletions
This file was deleted.

tests/testthat/test-smk-standardiseDf.R

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ test_that(".identify_class_conflicts returns correct output", {
144144
})
145145

146146
test_that("ask_question displays the correct prompt", {
147-
expect_snapshot(ask_question_class("my_var"))
147+
expect_message(ask_question_class("my_var"), "Convert.*my_var.*factor")
148148
})
149149

150150
test_that("ask_question_wait_response_class continues with valid response", {
@@ -167,11 +167,12 @@ test_that("ask_question_wait_response_class throws error if option 6 selected",
167167
})
168168

169169
test_that("print_all_classes prints the correct message", {
170-
expect_snapshot(
170+
expect_message(
171171
print_all_classes(
172172
c("server_1", "server_2", "server_3"),
173173
c("numeric", "factor", "integer")
174-
)
174+
),
175+
"server_1.*numeric"
175176
)
176177
})
177178

@@ -359,7 +360,7 @@ test_that("ask_question_wait_response_levels aborts with response of 3", {
359360
})
360361

361362
test_that(".make_levels_message makes correct message", {
362-
expect_snapshot(.make_levels_message(level_conflicts))
363+
expect_message(.make_levels_message(level_conflicts), "factor variables.*fac_col2.*do not have the same levels")
363364
})
364365

365366
test_that(".get_unique_levels extracts all possible levels", {
@@ -417,18 +418,20 @@ test_that(".set_factor_levels sets levels correctly", {
417418
})
418419

419420
test_that(".print_var_recode_message prints the correct message", {
420-
expect_snapshot(.print_var_recode_message(added_cols, "test_df"))
421+
expect_message(.print_var_recode_message(added_cols, "test_df"), "variables have been added to test_df")
421422
})
422423

423424
test_that(".print_class_recode_message prints the correct message", {
424-
expect_snapshot(
425-
.print_class_recode_message(class_decisions, different_classes, "test_df")
425+
expect_message(
426+
.print_class_recode_message(class_decisions, different_classes, "test_df"),
427+
"classes have been set.*test_df"
426428
)
427429
})
428430

429431
test_that(".print_levels_recode_message prints the correct message", {
430-
expect_snapshot(
431-
.print_levels_recode_message(unique_levs, "test_df")
432+
expect_message(
433+
.print_levels_recode_message(unique_levs, "test_df"),
434+
"levels have been set.*test_df"
432435
)
433436
})
434437

@@ -445,10 +448,11 @@ test_that(".make_levels_recode_message prints the correct message", {
445448
})
446449

447450
test_that(".print_out_messages prints the correct messages", {
448-
expect_snapshot(
451+
expect_message(
449452
.print_out_messages(
450453
added_cols, class_decisions, different_classes, unique_levs, level_conflicts, "1", "test_df"
451-
)
454+
),
455+
"variables have been added to test_df"
452456
)
453457
})
454458

0 commit comments

Comments
 (0)