Skip to content

Commit

Permalink
Merge pull request #84 from larmarange/tt3
Browse files Browse the repository at this point in the history
improve tests
  • Loading branch information
larmarange authored Jan 7, 2025
2 parents 629a438 + 700f422 commit f7d8b98
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 96 deletions.
4 changes: 2 additions & 2 deletions tests/testthat.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#
# Where should you do additional test configuration?
# Learn more about the roles of various files in:
# * https://r-pkgs.org/tests.html
# * https://testthat.r-lib.org/reference/test_package.html#special-files
# * https://r-pkgs.org/testing-design.html#sec-tests-files-overview
# * https://testthat.r-lib.org/articles/special-files.html

library(testthat)
library(ggstats)
Expand Down
79 changes: 0 additions & 79 deletions tests/testthat/_snaps/stat_prop/geom-prop-bar-geom-prop-text.svg

This file was deleted.

20 changes: 8 additions & 12 deletions tests/testthat/test-ggcoef_model.R
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,8 @@ test_that("ggcoef_compare()", {
c("Male", "Female", "Child", "Adult", "1st", "2nd", "3rd", "Crew")
)

expect_error(
ggcoef_compare(models, add_reference_rows = FALSE),
NA
expect_no_error(
ggcoef_compare(models, add_reference_rows = FALSE)
)
})

Expand Down Expand Up @@ -305,23 +304,20 @@ test_that("ggcoef_model() works with pairwise contratst", {
skip_if_not_installed("broom.helpers")
skip_if_not_installed("emmeans")
mod <- lm(Sepal.Length ~ Sepal.Width + Species, data = iris)
expect_error(
ggcoef_model(mod, add_pairwise_contrasts = TRUE),
NA
expect_no_error(
ggcoef_model(mod, add_pairwise_contrasts = TRUE)
)
expect_error(
expect_no_error(
ggcoef_model(
mod,
add_pairwise_contrasts = TRUE,
pairwise_variables = dplyr::starts_with("Sp"),
keep_model_terms = TRUE
),
NA
)
)
mod2 <- lm(Sepal.Length ~ Species, data = iris)
expect_error(
ggcoef_compare(list(mod, mod2), add_pairwise_contrasts = TRUE),
NA
expect_no_error(
ggcoef_compare(list(mod, mod2), add_pairwise_contrasts = TRUE)
)
})

Expand Down
5 changes: 2 additions & 3 deletions tests/testthat/test-gglikert.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,8 @@ test_that("gglikert()", {
gglikert(df)
)

expect_error(
d <- gglikert_data(df),
NA
expect_no_error(
d <- gglikert_data(df)
)
expect_equal(levels(d$.answer), likert_levels)

Expand Down

0 comments on commit f7d8b98

Please sign in to comment.