Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Dec 19, 2023
1 parent 9057fbc commit a3b5ba4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
24 changes: 24 additions & 0 deletions tests/testthat/_snaps/check_itemscale.md
Original file line number Diff line number Diff line change
@@ -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

3 changes: 2 additions & 1 deletion tests/testthat/test-check_itemscale.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
test_that("check_convergence", {
test_that("check_itemscale", {
skip_if_not_installed("parameters")

set.seed(123)
Expand All @@ -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(
Expand Down

0 comments on commit a3b5ba4

Please sign in to comment.