tests/testthat/test-set_scenario_settings.R

# work around to ensure the package can read in the data
# needs to be saved in the inst folder
path <- system.file("testdata", "three1", "scenario_0", package = "mm.reoptimise") # not ran
path2 <- system.file("testdata", "three2", "scenario_0", package = "mm.reoptimise") # not ran
path3 <- system.file("testdata", "three1", "scenario_1", package = "mm.reoptimise") # already ran

path <- c(path, path2, path3)
scenario_multiple <- purrr::map(path, create_scenario)

# NOTE: update this to test all scenarios in the folder via map / map2
scenario <- scenario_multiple[[1]]

test_that("function returns correctly", {

      scenario <- set_scenario_settings(scenario, user_budget = NA)
      expect_true(is.na(get_scenario_budget(scenario)))

      val <- 40e6
      scenario <- set_scenario_settings(scenario, user_budget = val)
      expect_equal(get_scenario_budget(scenario), val)

})
cath-parkinson/mm.reoptimise documentation built on May 12, 2022, 3:34 p.m.