diff --git a/tests/testthat/_snaps/survival_plot/survival-plot-no-wrap-no-ci-km-ggplot2.svg b/tests/testthat/_snaps/survival_plot/nowrap-noci-km-ggplot2.svg similarity index 99% rename from tests/testthat/_snaps/survival_plot/survival-plot-no-wrap-no-ci-km-ggplot2.svg rename to tests/testthat/_snaps/survival_plot/nowrap-noci-km-ggplot2.svg index 88b5b1514..f29d77fa5 100644 --- a/tests/testthat/_snaps/survival_plot/survival-plot-no-wrap-no-ci-km-ggplot2.svg +++ b/tests/testthat/_snaps/survival_plot/nowrap-noci-km-ggplot2.svg @@ -309,6 +309,6 @@ A B C -survival_plot-no wrap + no ci + km + ggplot2 +nowrap-noci-km-ggplot2 diff --git a/tests/testthat/_snaps/survival_plot/survival-plot-with-no-wrap-and-no-ci.svg b/tests/testthat/_snaps/survival_plot/nowrap-noci.svg similarity index 99% rename from tests/testthat/_snaps/survival_plot/survival-plot-with-no-wrap-and-no-ci.svg rename to tests/testthat/_snaps/survival_plot/nowrap-noci.svg index 69678884e..ac8e53531 100644 --- a/tests/testthat/_snaps/survival_plot/survival-plot-with-no-wrap-and-no-ci.svg +++ b/tests/testthat/_snaps/survival_plot/nowrap-noci.svg @@ -95,6 +95,6 @@ A B C -survival_plot with no wrap and no ci +nowrap-noci diff --git a/tests/testthat/_snaps/survival_plot/survival-plot-with-wrap-and-ci.svg b/tests/testthat/_snaps/survival_plot/wrap-ci.svg similarity index 99% rename from tests/testthat/_snaps/survival_plot/survival-plot-with-wrap-and-ci.svg rename to tests/testthat/_snaps/survival_plot/wrap-ci.svg index 586f17b21..98394fb83 100644 --- a/tests/testthat/_snaps/survival_plot/survival-plot-with-wrap-and-ci.svg +++ b/tests/testthat/_snaps/survival_plot/wrap-ci.svg @@ -204,6 +204,6 @@ t 2 ) -survival_plot with wrap and ci +wrap-ci diff --git a/tests/testthat/test-survival_plot.R b/tests/testthat/test-survival_plot.R index 1b5177b84..646f078ec 100644 --- a/tests/testthat/test-survival_plot.R +++ b/tests/testthat/test-survival_plot.R @@ -1,4 +1,10 @@ +## Code to re-run this from commandline +# JMPOST_GRAPH_SNAPSHOT=TRUE \ +# NOT_CRAN=TRUE \ +# Rscript -e "devtools::load_all(); testthat::test_file('tests/testthat/test-survival_plot.R')" + +snap_dir <- file.path(testthat::test_path(), "_snaps", "survival_plot") test_that("survival_plot works as expected", { @@ -64,9 +70,11 @@ test_that("survival_plot works as expected", { x_label = expression(thd[3]) ) + + announce_snapshot_file(file.path(snap_dir, "wrap-ci.svg")) if (is_graph_snapshot_enabled()) { vdiffr::expect_doppelganger( - "survival_plot with wrap and ci", + "wrap-ci", p1 ) } @@ -81,9 +89,10 @@ test_that("survival_plot works as expected", { x_label = expression(thd[3]) ) + announce_snapshot_file(file.path(snap_dir, "nowrap-noci.svg")) if (is_graph_snapshot_enabled()) { vdiffr::expect_doppelganger( - "survival_plot with no wrap and no ci", + "nowrap-noci", p2 ) } @@ -100,10 +109,15 @@ test_that("survival_plot works as expected", { theme(legend.position = "bottom") + scale_y_continuous(trans = "sqrt") + announce_snapshot_file(file.path(snap_dir, "nowrap-noci-km-ggplot2.svg")) if (is_graph_snapshot_enabled()) { vdiffr::expect_doppelganger( - "survival_plot-no wrap + no ci + km + ggplot2 ", + "nowrap-noci-km-ggplot2", p3 ) } + + # Null test so that its not considered as an empty test if the "JMPOST_GRAPH_SNAPSHOT" + # variable is not set + expect_equal(1, 1) })