Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Apr 3, 2024
1 parent e8bb2f9 commit 816ac64
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/testthat/test-cronbachs_alpha.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ test_that("cronbachs_alpha, data frame", {
expect_equal(cronbachs_alpha(x), 0.09463206, tolerance = 1e-3)
})
test_that("cronbachs_alpha", {
expect_warning(expect_null(cronbachs_alpha(mtcars[1])))
expect_message(expect_null(cronbachs_alpha(mtcars[1])), regex = "Too few")
})


test_that("cronbachs_alpha, principal_components", {
skip_if_not_installed("parameters", minimum_version = "0.21.3")
pca <- parameters::principal_components(mtcars[, c("cyl", "gear", "carb", "hp")], n = 2)
expect_equal(cronbachs_alpha(pca, verbose = FALSE), c(PC1 = 0.1101384), tolerance = 1e-3)
expect_warning(cronbachs_alpha(pca))
expect_message(cronbachs_alpha(pca), regex = "Too few")

pca <- parameters::principal_components(mtcars[, c("cyl", "gear", "carb", "hp")], n = 1)
expect_equal(cronbachs_alpha(pca, verbose = FALSE), c(PC1 = 0.09463206), tolerance = 1e-3)
Expand Down

0 comments on commit 816ac64

Please sign in to comment.