diff --git a/tests/testthat/_snaps/plot.check_dag/plot-check-dag-multiple-adjustments.svg b/tests/testthat/_snaps/plot.check_dag/plot-check-dag-multiple-adjustments.svg new file mode 100644 index 000000000..0aa4206e4 --- /dev/null +++ b/tests/testthat/_snaps/plot.check_dag/plot-check-dag-multiple-adjustments.svg @@ -0,0 +1,338 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +alertness + +exam + +humor + +mood + +podcast + +prepared + +skills_course + + +Current model + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +alertness + +exam + +humor + +mood + +podcast + +prepared + +skills_course + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +alertness + +exam + +humor + +mood + +podcast + +prepared + +skills_course + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +alertness + +exam + +humor + +mood + +podcast + +prepared + +skills_course + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +alertness + +exam + +humor + +mood + +podcast + +prepared + +skills_course + + + + + + + + + +Adjusted for mood, prepared + + + + + + + + + +Adjusted for mood, skills_course + + + + + + + + + +Adjusted for alertness, prepared + + + + + + + + + +Adjusted for alertness, skills_course + + + + + + +outcome +exposure +adjusted +unadjusted +Required model +plot.check_dag multiple adjustments + + diff --git a/tests/testthat/test-plot.check_dag.R b/tests/testthat/test-plot.check_dag.R index 00cf68bd9..917c1079d 100644 --- a/tests/testthat/test-plot.check_dag.R +++ b/tests/testthat/test-plot.check_dag.R @@ -51,3 +51,22 @@ test_that("`plot()` for check_dag", { fig = plot(dag, which = "required") ) }) + + +test_that("`plot()` for check_dag, multiple adjustment sets", { + set.seed(1234) + dag <- performance::check_dag( + podcast ~ mood + humor + skills_course, + alertness ~ mood, + mood ~ humor, + prepared ~ skills_course, + exam ~ alertness + prepared, + exposure = "podcast", + outcome = "exam", + coords = ggdag::time_ordered_coords() + ) + vdiffr::expect_doppelganger( + title = "plot.check_dag multiple adjustments", + fig = plot(dag) + ) +})