Skip to content

Commit e80e18c

Browse files
committed
fix test
1 parent 3002e48 commit e80e18c

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

R/combine_checkboxes.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#' by adding numeric suffixes. See [vctrs::vec_as_names()] for more options.
3131
#' @param multi_value_label A string specifying the value to be used when multiple
3232
#' checkbox fields are selected. Default "Multiple".
33-
#' If `NULL`, multiple selections will be pasted together
33+
#' If `NULL`, multiple selections will be pasted together.
3434
#' @param multi_value_sep (if `multi_value_label` is `NULL`) a string
3535
#' specifying the separator to use to paste multiple selections together.
3636
#' @param values_fill Value to use when no checkboxes are selected. Default `NA`.

tests/testthat/test-combine_checkboxes.R

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -233,21 +233,22 @@ test_that("combine_checkboxes works for multiple checkbox fields with concatenat
233233
out <- combine_checkboxes(
234234
supertbl = supertbl,
235235
tbl = "nonrepeat_instrument",
236-
cols = starts_with("multi"),
236+
cols = c(starts_with("multi"), starts_with("single_checkbox")),
237237
keep = FALSE,
238238
multi_value_label = NULL
239239
) %>%
240240
pull(redcap_data) %>%
241241
dplyr::first()
242242

243243
expected_out <- tibble::tribble(
244-
~"study_id", ~"single_checkbox___1", ~"extra_data", ~"multi",
245-
1, TRUE, 1, "Red",
246-
2, TRUE, 2, "Red, Yellow",
247-
3, FALSE, 3, NA
244+
~"study_id", ~"extra_data", ~"multi", ~"single_checkbox",
245+
1, 1, "Red", "Green",
246+
2, 2, "Red, Yellow", "Green",
247+
3, 3, NA, NA
248248
) %>%
249249
mutate(
250-
multi = factor(multi, levels = c("Red", "Yellow", "Blue", "Red, Yellow"))
250+
multi = factor(multi, levels = c("Red", "Yellow", "Blue", "Red, Yellow")),
251+
single_checkbox = factor(single_checkbox, levels = "Green")
251252
)
252253

253254
expect_equal(out, expected_out)

0 commit comments

Comments
 (0)