From d2f44f47106915976d4b68ecd88ead0b64ec2d1b Mon Sep 17 00:00:00 2001
From: *** Li Ma ***
Date: Tue, 26 Aug 2025 16:09:28 -0400
Subject: [PATCH 1/2] Tested the fix done by Nan of the issue #87 regarding n &
pct display in format_ae_forestly
---
tests/testthat/test-format_ae_forestly.R | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/tests/testthat/test-format_ae_forestly.R b/tests/testthat/test-format_ae_forestly.R
index baddb92..9944d09 100644
--- a/tests/testthat/test-format_ae_forestly.R
+++ b/tests/testthat/test-format_ae_forestly.R
@@ -46,6 +46,29 @@ test_that("Set `display` to ('n', 'prop', 'total') then one has total column", {
expect_false("total" %in% names(ae_frm))
})
+test_that("Set `display` to ('diff', 'total') without ('n', 'prop') columns", {
+ out <- test_format_ae_forestly()
+ ae_frm <- format_ae_forestly(
+ out,
+ display = c("diff", "total"),
+ digits = 1,
+ width_term = 200,
+ width_fig = 300,
+ width_n = 40,
+ width_prop = 60,
+ width_diff = 80,
+ footer_space = 90,
+ color = NULL,
+ diff_label = "Treatment <- Favor -> Placebo",
+ show_ae_parameter = FALSE
+ )
+
+ # expect_named(ae_frm, c("n", "prop", "total"))
+ expect_named(ae_frm)
+ expect_true("diff" %in% names(ae_frm))
+ expect_false("total" %in% names(ae_frm))
+})
+
test_that("1. Set `display` to ('n', 'prop', 'total', 'diff') and change column width using argument
2. Change `diff_label` to 'MK-xxxx <- Favor -> Placebo' and 'footer_space' to change location of footer", {
out <- test_format_ae_forestly()
From bec243d149ba2d55f23f26b6ff27eee616bd638f Mon Sep 17 00:00:00 2001
From: *** Li Ma ***
Date: Tue, 2 Sep 2025 12:40:38 -0400
Subject: [PATCH 2/2] modification to prior changes
---
tests/testthat/test-format_ae_forestly.R | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/testthat/test-format_ae_forestly.R b/tests/testthat/test-format_ae_forestly.R
index 9944d09..c1df0de 100644
--- a/tests/testthat/test-format_ae_forestly.R
+++ b/tests/testthat/test-format_ae_forestly.R
@@ -65,8 +65,8 @@ test_that("Set `display` to ('diff', 'total') without ('n', 'prop') columns", {
# expect_named(ae_frm, c("n", "prop", "total"))
expect_named(ae_frm)
- expect_true("diff" %in% names(ae_frm))
- expect_false("total" %in% names(ae_frm))
+ expect_true("diff" %in% ae_frm$display[1])
+ expect_true("total" %in% ae_frm$display[2])
})
test_that("1. Set `display` to ('n', 'prop', 'total', 'diff') and change column width using argument