test_that("plot_isotherm runs without error for all 5 models", { Ce <- c(2, 5, 10, 20, 35, 50, 70, 90) qe <- c(0.8, 1.6, 2.3, 3.0, 3.6, 4.0, 4.4, 4.6) pdf(NULL) on.exit(dev.off()) expect_no_error(plot_isotherm(fit_langmuir(Ce, qe), Ce, qe, model = "langmuir")) expect_no_error(plot_isotherm(fit_freundlich(Ce, qe), Ce, qe, model = "freundlich")) expect_no_error(plot_isotherm(fit_temkin(Ce, qe), Ce, qe, model = "temkin")) expect_no_error(plot_isotherm(fit_dr(Ce, qe), Ce, qe, model = "dr")) expect_no_error(plot_isotherm(fit_sips(Ce, qe), Ce, qe, model = "sips")) }) test_that("plot_isotherm infers langmuir/freundlich when model is omitted", { Ce <- c(2, 5, 10, 20, 35, 50, 70) qe <- c(0.8, 1.6, 2.3, 3.0, 3.6, 4.0, 4.4) pdf(NULL) on.exit(dev.off()) expect_no_error(plot_isotherm(fit_langmuir(Ce, qe), Ce, qe)) expect_no_error(plot_isotherm(fit_freundlich(Ce, qe), Ce, qe)) }) test_that("plot_kinetics runs without error for all 4 models", { t <- c(5, 15, 30, 60, 120, 240) qt <- c(1.2, 2.1, 2.9, 3.6, 4.0, 4.2) pdf(NULL) on.exit(dev.off()) expect_no_error(plot_kinetics(fit_pfo(t, qt), t, qt, model = "pfo")) expect_no_error(plot_kinetics(fit_pso(t, qt), t, qt, model = "pso")) expect_no_error(plot_kinetics(fit_elovich(t, qt), t, qt, model = "elovich")) expect_no_error(plot_kinetics(fit_intraparticle(t, qt), t, qt, model = "intraparticle")) }) test_that("plot_ftir_spectrum runs without error", { spec <- data.frame(wavenumber_cm1 = seq(4000, 400, by = -10), intensity = runif(361, 0, 1)) pdf(NULL) on.exit(dev.off()) expect_no_error(plot_ftir_spectrum(spec)) }) test_that("save_tiff produces a real file", { Ce <- c(2, 5, 10, 20, 35, 50, 70) qe <- c(0.8, 1.6, 2.3, 3.0, 3.6, 4.0, 4.4) fit <- fit_langmuir(Ce, qe) path <- tempfile(fileext = ".tif") save_tiff(plot_isotherm(fit, Ce, qe), filename = path) expect_true(file.exists(path)) expect_gt(file.size(path), 0) unlink(path) })