From a3b5ba4d43f2fe0c3ecf279bf8b8243ff033c03e Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 19 Dec 2023 17:42:07 +0100 Subject: [PATCH] add test --- tests/testthat/_snaps/check_itemscale.md | 24 ++++++++++++++++++++++++ tests/testthat/test-check_itemscale.R | 3 ++- 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 tests/testthat/_snaps/check_itemscale.md diff --git a/tests/testthat/_snaps/check_itemscale.md b/tests/testthat/_snaps/check_itemscale.md new file mode 100644 index 000000000..48e0bd482 --- /dev/null +++ b/tests/testthat/_snaps/check_itemscale.md @@ -0,0 +1,24 @@ +# check_itemscale + + Code + print(out) + Output + # Description of (Sub-)ScalesComponent 1 + + Item | Missings | Mean | SD | Skewness | Difficulty | Discrimination | alpha if deleted + ----------------------------------------------------------------------------------------- + b | 0 | 5.02 | 0.79 | -0.04 | 0.84 | 0.06 | -0.55 + e | 0 | 2.12 | 0.81 | -0.22 | 0.35 | -0.09 | -0.03 + f | 0 | 2.00 | 0.82 | 0.00 | 0.33 | -0.16 | 0.17 + + Mean inter-item-correlation = -0.046 Cronbach's alpha = -0.159 + Component 2 + + Item | Missings | Mean | SD | Skewness | Difficulty | Discrimination | alpha if deleted + ----------------------------------------------------------------------------------------- + a | 0 | 5.02 | 0.83 | -0.04 | 0.84 | 0.21 | -0.18 + c | 0 | 4.74 | 0.81 | 0.51 | 0.79 | -0.04 | 0.41 + d | 0 | 2.07 | 0.79 | -0.13 | 0.34 | 0.13 | 0.04 + + Mean inter-item-correlation = 0.067 Cronbach's alpha = 0.178 + diff --git a/tests/testthat/test-check_itemscale.R b/tests/testthat/test-check_itemscale.R index d64dbaea6..0c2d605fc 100644 --- a/tests/testthat/test-check_itemscale.R +++ b/tests/testthat/test-check_itemscale.R @@ -1,4 +1,4 @@ -test_that("check_convergence", { +test_that("check_itemscale", { skip_if_not_installed("parameters") set.seed(123) @@ -25,6 +25,7 @@ test_that("check_convergence", { tolerance = 1e-4, ignore_attr = TRUE ) + expect_snapshot(print(out)) comp <- parameters::closest_component(pca) out2 <- check_itemscale(d, comp) expect_equal(