Skip to content

Commit edc1d27

Browse files
committed
tests: add default spec failure test
1 parent c5294bb commit edc1d27

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

tests/testthat/test-utils.R

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,33 @@ testthat::test_that("assert_single_selection fails when multiple selection is se
5454
tm_g_bivariate(
5555
"a label",
5656
x,
57-
x
57+
mock_spec2
5858
),
5959
"'x' should not allow multiple selection"
6060
)
6161

6262
testthat::expect_error(
6363
tm_g_bivariate(
6464
"a label",
65-
list(mock_spec2, mock_spec, data_extract_spec("EMPTY")),
66-
x
65+
list(mock_spec2, mock_spec),
66+
mock_spec2
67+
),
68+
"'x' should not allow multiple selection"
69+
)
70+
})
71+
72+
testthat::test_that("assert_single_selection fails when with default spec", {
73+
# Suppress logger messages
74+
local_logger_threshold(logger::FATAL)
75+
76+
testthat::expect_error(
77+
tm_g_bivariate(
78+
"a label",
79+
data_extract_spec("DEFAULT"),
80+
data_extract_spec(
81+
"VALID",
82+
teal.transform::select_spec(choices = c("A", "B"), multiple = FALSE)
83+
)
6784
),
6885
"'x' should not allow multiple selection"
6986
)

0 commit comments

Comments
 (0)