diff --git a/tests/testthat/_snaps/ard_svychisq.md b/tests/testthat/_snaps/ard_svychisq.md index b495a9098..46f7f46df 100644 --- a/tests/testthat/_snaps/ard_svychisq.md +++ b/tests/testthat/_snaps/ard_svychisq.md @@ -1,4 +1,4 @@ -# ard_svychisq() works with multiple variables +# ard_svychisq() works Code as.data.frame(dplyr::slice_head(dplyr::group_by(dplyr::select(ard_svychisq( diff --git a/tests/testthat/test-ard_svychisq.R b/tests/testthat/test-ard_svychisq.R index 4a43ab1f8..be6f155cb 100644 --- a/tests/testthat/test-ard_svychisq.R +++ b/tests/testthat/test-ard_svychisq.R @@ -23,12 +23,8 @@ test_that("ard_svychisq() works", { survey::svychisq(~ sch.wide + comp.imp, dclus2)[c("statistic", "p.value")], ignore_attr = TRUE ) -}) - -test_that("ard_svychisq() works with multiple variables", { - data(api, package = "survey") - dclus2 <- survey::svydesign(id = ~ dnum + snum, fpc = ~ fpc1 + fpc2, data = apiclus2) + # test that the function works with multiple variables expect_snapshot( ard_svychisq( dclus2, @@ -41,4 +37,15 @@ test_that("ard_svychisq() works with multiple variables", { dplyr::slice_head(n = 3) |> as.data.frame() ) + + + expect_equal( + dplyr::bind_rows( + ard_svychisq, + dclus2 |> + ard_svychisq(by = comp.imp, variables = stype) + ), + dclus2 |> + ard_svychisq(by = comp.imp, variables = c(sch.wide, stype)) + ) })