FreesearchR/tests/testthat/test-baseline_table.R
Andreas Gammelgaard Damsbo 3f31cf38b8
Some checks are pending
pkgdown.yaml / pkgdown (push) Waiting to run
adding first tests
2025-04-14 12:13:38 +02:00

42 lines
1.1 KiB
R

## With snapshots
##
test_that("Creates correct table",{
expect_snapshot(create_baseline(mtcars,by.var = "gear", add.p = "yes" == "yes",add.overall = TRUE, theme = "lancet"))
})
test_that("Creates table", {
tbl <- mtcars |> baseline_table(fun.args = list(by = "gear"))
expect_equal(length(tbl), 5)
expect_equal(NROW(tbl$table_body), 19)
expect_equal(NCOL(tbl$table_body), 8)
expect_equal(names(tbl), c("table_body", "table_styling", "call_list", "cards", "inputs"))
})
test_that("Creates table", {
tbl <- mtcars |> create_baseline(by.var = "gear", add.p = "yes" == "yes")
expect_equal(length(tbl), 5)
expect_equal(NROW(tbl$table_body), 19)
expect_equal(NCOL(tbl$table_body), 13)
expect_equal(names(tbl), c("table_body", "table_styling", "call_list", "cards", "inputs"))
})
test_that("Creates table", {
tbl <- mtcars |> create_baseline(by.var = "gear", add.p = "yes" == "yes")
expect_equal(length(tbl), 5)
expect_equal(NROW(tbl$table_body), 19)
expect_equal(NCOL(tbl$table_body), 13)
expect_equal(names(tbl), c("table_body", "table_styling", "call_list", "cards", "inputs"))
})