test_that("rob_save writes a PNG file", { p <- rob_summary(data_rob2, tool = "ROB2", quiet = TRUE) tmp <- withr::local_tempfile(fileext = ".png") out <- rob_save(p, tmp, width = 6, height = 4, dpi = 72) expect_true(file.exists(tmp)) expect_gt(file.size(tmp), 1000L) expect_equal(out, tmp) }) test_that("rob_save writes a JPEG file", { p <- rob_traffic_light(data_rob2, tool = "ROB2", quiet = TRUE) tmp <- withr::local_tempfile(fileext = ".jpg") rob_save(p, tmp, width = 6, height = 4, dpi = 72) expect_true(file.exists(tmp)) }) test_that("rob_save errors on unsupported extension", { p <- rob_summary(data_rob2, tool = "ROB2", quiet = TRUE) tmp <- withr::local_tempfile(fileext = ".docx") expect_error(rob_save(p, tmp), "Unsupported file extension") }) test_that("rob_example_data lists all datasets", { nms <- rob_example_data() expect_true("data_rob2" %in% nms) expect_true("data_nos_cohort" %in% nms) }) test_that("rob_example_data returns correct data frame", { d <- rob_example_data("data_rob2") expect_s3_class(d, "data.frame") expect_equal(nrow(d), 9L) expect_true("Study" %in% names(d)) }) test_that("rob_example_data errors on unknown name", { expect_error(rob_example_data("nonexistent"), "not found") })