test_that("ml_report writes a file to the specified path", { s <- iris_split() model <- ml_fit(s$train, "Species", algorithm = "random_forest", seed = 42L) tmp <- tempfile(fileext = ".html") on.exit(unlink(tmp)) ml_report(model, data = s$valid, path = tmp) expect_true(file.exists(tmp)) }) test_that("ml_report output is HTML", { s <- iris_split() model <- ml_fit(s$train, "Species", algorithm = "random_forest", seed = 42L) tmp <- tempfile(fileext = ".html") on.exit(unlink(tmp)) ml_report(model, data = s$valid, path = tmp) content <- paste(readLines(tmp, warn = FALSE), collapse = "\n") expect_true(grepl("", content, fixed = TRUE)) expect_true(grepl(" 0L) })