Skip to content

Commit

Permalink
Add test ensuring expected start year of target_sda (#440)
Browse files Browse the repository at this point in the history
* add failing test

* add passing test

* update test name
  • Loading branch information
jdhoffa authored Jul 19, 2023
1 parent cd3611c commit 568d804
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/testthat/test-target_sda.R
Original file line number Diff line number Diff line change
Expand Up @@ -806,3 +806,17 @@ test_that("region_isos only has lowercase isos #398", {
)
)
})

test_that("produces output with expected start years #439", {

out <- target_sda(
fake_matched(sector_abcd = "cement"),
fake_abcd(sector = "cement", year = c(2024, 2025)),
fake_co2_scenario(year = c(2025, 2050), emission_factor = c(0.5, 0.2)),
region_isos = region_isos_stable
)

out_relevant <- filter(out, grepl("target", emission_factor_metric))

expect_equal(min(out_relevant$year), 2025L)
})

0 comments on commit 568d804

Please sign in to comment.