Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ayogasekaram committed Mar 14, 2024
1 parent de8c2ac commit 176ffcd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion tests/testthat/_snaps/ard_svychisq.md
Original file line number Diff line number Diff line change
@@ -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(
Expand Down
17 changes: 12 additions & 5 deletions tests/testthat/test-ard_svychisq.R
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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))
)
})

0 comments on commit 176ffcd

Please sign in to comment.