Skip to content

Commit db67f0a

Browse files
test: update for compatibility w/ legacy + current moo
1 parent 6df8d71 commit db67f0a

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

‎tests/testthat/helper-cli.R‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,20 @@ setup_cli_workspace <- function(prefix = "mosuite_normalize_counts_test_") {
5757
)
5858
}
5959

60+
is_compatible_multiOmicDataSet <- function(moo) {
61+
moo_classes <- class(moo)
62+
has_moo_class_label <-
63+
inherits(moo, "multiOmicDataSet") ||
64+
any(grepl("(^|::)multiOmicDataSet$", moo_classes))
65+
66+
is_current_s7_moo <- tryCatch(
67+
S7::S7_inherits(moo, MOSuite::multiOmicDataSet),
68+
error = function(e) FALSE
69+
)
70+
71+
return(is_current_s7_moo || has_moo_class_label)
72+
}
73+
6074
expect_outputs_created <- function(results_dir) {
6175
moo_path <- file.path(results_dir, "moo", "moo-norm.rds")
6276

@@ -70,8 +84,9 @@ expect_outputs_created <- function(results_dir) {
7084
)
7185

7286
moo <- readr::read_rds(moo_path)
87+
7388
expect_true(
74-
inherits(moo, "MOSuite::multiOmicDataSet"),
89+
is_compatible_multiOmicDataSet(moo),
7590
info = "Output should be an S7 multiOmicDataSet object"
7691
)
7792

‎tests/testthat/test-main.R‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ test_that("code/run accepts plotting CLI arguments", {
146146

147147
moo <- readr::read_rds(file.path(results_dir, "moo", "moo-norm.rds"))
148148
expect_true(
149-
S7::S7_inherits(moo, MOSuite::multiOmicDataSet),
149+
is_compatible_multiOmicDataSet(moo),
150150
info = "Output should be an S7 multiOmicDataSet object"
151151
)
152152
expect_true(

0 commit comments

Comments
 (0)