2025-04-14 12:13:38 +02:00
|
|
|
## With snapshots
|
|
|
|
##
|
|
|
|
|
|
|
|
test_that("Creates correct table",{
|
2025-04-15 08:55:35 +02:00
|
|
|
## This is by far the easiest way to test all functions. Based on examples.
|
2025-04-15 16:14:03 +02:00
|
|
|
tbl <- create_baseline(mtcars,by.var = "gear", add.p = "yes" == "yes",add.overall = TRUE, theme = "lancet")
|
2025-04-14 12:13:38 +02:00
|
|
|
|
2025-04-15 16:14:03 +02:00
|
|
|
expect_equal(length(tbl),5)
|
2025-04-14 12:13:38 +02:00
|
|
|
|
|
|
|
expect_equal(NROW(tbl$table_body), 19)
|
|
|
|
|
|
|
|
expect_equal(NCOL(tbl$table_body), 13)
|
2025-04-15 16:14:03 +02:00
|
|
|
tbl$call_list
|
2025-04-14 12:13:38 +02:00
|
|
|
expect_equal(names(tbl), c("table_body", "table_styling", "call_list", "cards", "inputs"))
|
|
|
|
|
2025-04-15 16:14:03 +02:00
|
|
|
tbl <- create_baseline(mtcars,by.var = "none", add.p = FALSE,add.overall = FALSE, theme = "lancet")
|
2025-04-14 12:13:38 +02:00
|
|
|
|
2025-04-15 16:14:03 +02:00
|
|
|
expect_equal(length(tbl),5)
|
2025-04-14 12:13:38 +02:00
|
|
|
|
2025-04-15 16:14:03 +02:00
|
|
|
tbl <- create_baseline(mtcars,by.var = "test", add.p = FALSE,add.overall = FALSE, theme = "jama")
|
2025-04-14 12:13:38 +02:00
|
|
|
|
2025-04-15 16:14:03 +02:00
|
|
|
expect_equal(length(tbl),5)
|
2025-04-14 12:13:38 +02:00
|
|
|
|
2025-04-15 16:14:03 +02:00
|
|
|
tbl <- create_baseline(default_parsing(mtcars),by.var = "am", add.p = FALSE,add.overall = FALSE, theme = "nejm")
|
|
|
|
|
|
|
|
expect_equal(length(tbl),5)
|
2025-04-14 12:13:38 +02:00
|
|
|
})
|
2025-04-15 16:14:03 +02:00
|
|
|
|