Skip to content

Commit

Permalink
Update snapshots (#1046)
Browse files Browse the repository at this point in the history
Closes #1045
  • Loading branch information
edelarua authored Aug 29, 2023
1 parent ef000bf commit 3b0de2e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 50 deletions.
16 changes: 8 additions & 8 deletions tests/testthat/_snaps/summarize_glm_count.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@
Code
res
Output
rate asymp.LCL asymp.UCL ARM
A: Drug X 3.07 2.202774 4.278651 A: Drug X
B: Placebo 3.07 2.202774 4.278651 B: Placebo
C: Combination 3.07 2.202774 4.278651 C: Combination
rate asymp.LCL asymp.UCL ARM
A: Drug X 9.029759 6.295928 12.95068 A: Drug X
B: Placebo 9.029759 6.295928 12.95068 B: Placebo
C: Combination 9.029759 6.295928 12.95068 C: Combination

# s_glm_count works with healthy input

Expand All @@ -82,12 +82,12 @@
[1] 73
$rate
[1] 3.486005
[1] 10.20612
attr(,"label")
[1] "Adjusted Rate"
$rate_ci
[1] 1.983340 6.127155
[1] 5.627535 18.509855
attr(,"label")
[1] "95% CI"
Expand Down Expand Up @@ -116,12 +116,12 @@
[1] 73
$rate
[1] 3.486005
[1] 10.20612
attr(,"label")
[1] "Adjusted Rate"
$rate_ci
[1] 1.983340 6.127155
[1] 5.627535 18.509855
attr(,"label")
[1] "95% CI"
Expand Down
40 changes: 0 additions & 40 deletions tests/testthat/_snaps/summary_stats.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,46 +20,6 @@
geom_mean geom_mean_ci geom_cv
"xx.x" "(xx.xx, xx.xx)" "xx.x"

---

Code
res
Output
$n
[1] "xx."
$count
[1] "xx."
$count_fraction
function(x, ...) {
attr(x, "label") <- NULL
if (any(is.na(x))) {
return("NA")
}
checkmate::assert_vector(x)
checkmate::assert_integerish(x[1])
assert_proportion_value(x[2], include_boundaries = TRUE)
result <- if (x[1] == 0) {
"0"
} else {
paste0(x[1], " (", round(x[2] * 100, 1), "%)")
}
return(result)
}
<environment: namespace:tern>
$n_blq
[1] "xx."
$pval
[1] "x.xxxx | (<0.0001)"

# summary_labels works as expected

Code
Expand Down
5 changes: 3 additions & 2 deletions tests/testthat/test-summary_stats.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ testthat::test_that("summary_formats works as expected", {
testthat::expect_snapshot(res)

result <- summary_formats(type = "counts", include_pval = TRUE)
res <- testthat::expect_silent(result)
testthat::expect_snapshot(res)
expect_true(all(result[c("n", "count", "n_blq")] == "xx."))
expect_identical(result[["pval"]], "x.xxxx | (<0.0001)")
expect_identical(result[["count_fraction"]], format_count_fraction)
})

testthat::test_that("summary_labels works as expected", {
Expand Down

0 comments on commit 3b0de2e

Please sign in to comment.