test_that("rob_summary returns a ggplot for ROB2", { p <- rob_summary(data_rob2, tool = "ROB2", quiet = TRUE) expect_s3_class(p, "gg") }) test_that("rob_summary works with overall = TRUE", { p <- rob_summary(data_rob2, tool = "ROB2", overall = TRUE, quiet = TRUE) expect_s3_class(p, "gg") }) test_that("rob_summary works with colourblind palette", { p <- rob_summary(data_rob2, tool = "ROB2", colour = "colourblind", quiet = TRUE) expect_s3_class(p, "gg") }) test_that("rob_summary works unweighted", { d <- data_rob2[, !names(data_rob2) %in% "Weight"] p <- rob_summary(d, tool = "ROB2", weighted = FALSE, quiet = TRUE) expect_s3_class(p, "gg") }) test_that("rob_summary handles >8 domains without truncation (issue #131)", { # Build a dataset with 10 domain columns d <- data.frame( Study = paste0("S", 1:5), stringsAsFactors = FALSE ) for (i in 1:10) d[[paste0("Domain", i)]] <- rep("Low", 5) p <- rob_summary(d, tool = "Generic", quiet = TRUE) pb <- ggplot2::ggplot_build(p) # All 10 domains should appear in y axis y_vals <- unique(pb$layout$panel_params[[1]]$y$limits) expect_gte(length(y_vals), 9L) }) test_that("rob_summary handles single study (issue #164)", { d <- data_rob2[1, ] expect_no_error(rob_summary(d, tool = "ROB2", quiet = TRUE)) }) test_that("rob_summary works for ROBINS-I", { p <- rob_summary(data_robins_i, tool = "ROBINS-I", quiet = TRUE) expect_s3_class(p, "gg") }) test_that("rob_summary works for NOS-Cohort (star counts → qualitative)", { p <- rob_summary(data_nos_cohort, tool = "NOS-Cohort", quiet = TRUE) expect_s3_class(p, "gg") }) test_that("rob_summary works for GRADE", { p <- rob_summary(data_grade, tool = "GRADE", quiet = TRUE) expect_s3_class(p, "gg") }) test_that("rob_summary errors on bad colour vector length", { expect_error( rob_summary(data_rob2, tool = "ROB2", colour = c("#aabbcc"), quiet = TRUE), "Colour vector length mismatch" ) })