tests/testthat/test-create_scenario_list.R

path <- system.file("testdata", "three4", package = "mm.reoptimise")
list_scenario_folders <- create_scenario_list(path)

element_names <- c("name",
                   "curves",
                   "kpi",
                   "kpi.level1",
                   "kpi.level2",
                   "kpi.level3",
                   "channel",
                   "channel.group.level1",
                   "channel.group.level2",
                   "channel.group.level3",
                   "period",
                   "alloc.unit",
                   "settings",
                   "constraints_settings",
                   "constraints",
                   "weights",
                   "curves_filtered",
                   "curves_full",
                   "kpi_weights")

test_that("output is a list of lists with expected length and data types", {
      expect_type(list_scenario_folders, "list")
      expect_type(list_scenario_folders[[1]], "list")
      expect_named(list_scenario_folders[[1]], element_names)
      expect_true(tibble::is_tibble(list_scenario_folders[[1]]$curves_full))
      expect_true(tibble::is_tibble(list_scenario_folders[[1]]$name))
})
cath-parkinson/mm.reoptimise documentation built on May 12, 2022, 3:34 p.m.