diff --git a/tests/testthat/_snaps/match_cohort/balance_all.csv b/tests/testthat/_snaps/match_cohort/balance_all.csv new file mode 100644 index 00000000..853f7859 --- /dev/null +++ b/tests/testthat/_snaps/match_cohort/balance_all.csv @@ -0,0 +1,4 @@ +"","u","v","smd" +"age",42.4760479041916,44.748502994012,0.122719796315446 +"sex_F",0.544910179640719,0.544910179640719,0 +"sex_M",0.455089820359281,0.455089820359281,0 diff --git a/tests/testthat/_snaps/match_cohort/balance_match.csv b/tests/testthat/_snaps/match_cohort/balance_match.csv new file mode 100644 index 00000000..853f7859 --- /dev/null +++ b/tests/testthat/_snaps/match_cohort/balance_match.csv @@ -0,0 +1,4 @@ +"","u","v","smd" +"age",42.4760479041916,44.748502994012,0.122719796315446 +"sex_F",0.544910179640719,0.544910179640719,0 +"sex_M",0.455089820359281,0.455089820359281,0 diff --git a/tests/testthat/_snaps/match_cohort/summary.csv b/tests/testthat/_snaps/match_cohort/summary.csv new file mode 100644 index 00000000..853f7859 --- /dev/null +++ b/tests/testthat/_snaps/match_cohort/summary.csv @@ -0,0 +1,4 @@ +"","u","v","smd" +"age",42.4760479041916,44.748502994012,0.122719796315446 +"sex_F",0.544910179640719,0.544910179640719,0 +"sex_M",0.455089820359281,0.455089820359281,0 diff --git a/tests/testthat/test-match_cohort.R b/tests/testthat/test-match_cohort.R index 218ed18a..64650a98 100644 --- a/tests/testthat/test-match_cohort.R +++ b/tests/testthat/test-match_cohort.R @@ -68,8 +68,15 @@ test_that("`match_cohort`: test for input validation", { }) #### Snapshot for summary -# test_that("`match_cohort`: summary snapshot", { #nolint -# # snapshot for summary -# summ <- capture.output(summary.match(matching)) #nolint -# expect_snapshot(summ) #nolint -# }) +test_that("`match_cohort`: summary snapshot", { # nolint + for (column in c("balance_all", "balance_match", "summary")) { + expect_similar_dataframes( + column, matching$balance_match, + list( + u = equal_with_tolerance(), + v = equal_with_tolerance(), + smd = equal_with_tolerance() + ) + ) + } +})