From 9c536f474ad6bcce182da40db55645d89671a9db Mon Sep 17 00:00:00 2001 From: Jackson Hoffart Date: Mon, 18 Mar 2024 14:24:46 +0100 Subject: [PATCH] add failing test --- tests/testthat/test-join_abcd_scenario.R | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/tests/testthat/test-join_abcd_scenario.R b/tests/testthat/test-join_abcd_scenario.R index 51580250..230226ed 100644 --- a/tests/testthat/test-join_abcd_scenario.R +++ b/tests/testthat/test-join_abcd_scenario.R @@ -273,7 +273,7 @@ test_that("outputs full timeline of scenario #157", { }) -test_that("doesnt output sectors not in input data #157", { +test_that("doesnt output sectors that aren't in input data #157", { out <- join_abcd_scenario( fake_matched(sector_abcd = "power"), @@ -288,3 +288,23 @@ test_that("doesnt output sectors not in input data #157", { expect_equal(unique(out$sector_abcd), "power") }) + +test_that("on fill in production timeline after t0 #157", { + + out <- join_abcd_scenario( + fake_matched(name_abcd = c("a", "b")), + fake_abcd( + name_company = c("a", "b"), + year = c(2020, 2021) + ), + fake_scenario(year = c(2020, 2021)), + region_isos = region_isos_stable + ) + + out_a <- filter(out, name_abcd == "a") + out_b <- filter(out, name_abcd == "b") + + expect_equal(max(out_a$year), 2021L) + expect_equal(min(out_b$year), 2021L) + +})