From 3255a3378b07ddda0947d5768c3535645f9e86e0 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 10 Feb 2025 21:51:13 +0100 Subject: [PATCH] add test --- .../_snaps/plot-ordinal/plot-ordinal-2.svg | 85 +++++++++++++++++++ tests/testthat/test-plot-ordinal.R | 8 +- 2 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 tests/testthat/_snaps/plot-ordinal/plot-ordinal-2.svg diff --git a/tests/testthat/_snaps/plot-ordinal/plot-ordinal-2.svg b/tests/testthat/_snaps/plot-ordinal/plot-ordinal-2.svg new file mode 100644 index 00000000..b41f211c --- /dev/null +++ b/tests/testthat/_snaps/plot-ordinal/plot-ordinal-2.svg @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +0.00 +0.25 +0.50 +0.75 +1.00 + + + + + + + + + + + +2.0 +2.5 +3.0 +3.5 +4.0 +4.5 +Sepal.Width +Predicted value of Species + +Response + + + + + + + + + +setosa +versicolor +virginica +plot-ordinal-2 + + diff --git a/tests/testthat/test-plot-ordinal.R b/tests/testthat/test-plot-ordinal.R index 23163858..78a936fe 100644 --- a/tests/testthat/test-plot-ordinal.R +++ b/tests/testthat/test-plot-ordinal.R @@ -9,10 +9,16 @@ skip_on_cran() test_that("plots ordinal", { m <- MASS::polr(Species ~ Sepal.Width, data = iris) out <- estimate_means(m, by = "Sepal.Width") - set.seed(123) vdiffr::expect_doppelganger( "plot-ordinal-1", plot(out, show_data = FALSE) ) + + out <- estimate_relation(m, by = "Sepal.Width") + set.seed(123) + vdiffr::expect_doppelganger( + "plot-ordinal-2", + plot(out, show_data = FALSE) + ) })