mirror of
https://github.com/agdamsbo/FreesearchR.git
synced 2026-06-19 04:27:30 +02:00
This commit is contained in:
parent
e980edc149
commit
3f31cf38b8
11 changed files with 149 additions and 20 deletions
12
tests/testthat.R
Normal file
12
tests/testthat.R
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
# This file is part of the standard setup for testthat.
|
||||
# It is recommended that you do not modify it.
|
||||
#
|
||||
# Where should you do additional test configuration?
|
||||
# Learn more about the roles of various files in:
|
||||
# * https://r-pkgs.org/testing-design.html#sec-tests-files-overview
|
||||
# * https://testthat.r-lib.org/articles/special-files.html
|
||||
|
||||
library(testthat)
|
||||
library(FreesearchR)
|
||||
|
||||
test_check("FreesearchR")
|
||||
4
tests/testthat/test-app_version.R
Normal file
4
tests/testthat/test-app_version.R
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
test_that("Version is character string", {
|
||||
expect_equal(length(app_version()), 1)
|
||||
expect_true(is.character(app_version()))
|
||||
})
|
||||
42
tests/testthat/test-baseline_table.R
Normal file
42
tests/testthat/test-baseline_table.R
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
## 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"))
|
||||
})
|
||||
3
tests/testthat/test-custom_SelectInput.R
Normal file
3
tests/testthat/test-custom_SelectInput.R
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
test_that("Create columnSelectInput", {
|
||||
expect_snapshot(columnSelectInput("x",label = "X",data = mtcars))
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue