Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix tests
Browse files Browse the repository at this point in the history
sbfnk committed Jan 31, 2025
1 parent cffd9f3 commit bcbf8a3
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tests/testthat/test-preprocessing.R
Original file line number Diff line number Diff line change
@@ -32,22 +32,22 @@ test_that("fill_missing warns about initial data points", {
fill_missing(cases, missing_dates = "accumulate"),
"Detected fixed accumulation frequency"
)
cases[1, date := date + 1]
shifted <- copy(cases)
shifted[1, date := date + 1]
expect_warning(
fill_missing(cases, missing_dates = "accumulate"),
fill_missing(shifted, missing_dates = "accumulate"),
"Initial data point not marked as accumulated"
)
})

test_that("add_horizon works", {
expect_warning(
fill_missing(cases, missing_dates = "accumulate"),
"Initial data point not marked as accumulated"
)
expect_equal(nrow(add_horizon(cases, horizon = 7L)), nrow(cases) + 7L)
})

test_that("add_horizon identifies gaps correctly", {
filled <- fill_missing(cases, missing_dates = "accumulate", initial_accumulate = 7)
filled <- fill_missing(
cases, missing_dates = "accumulate", initial_accumulate = 7
)
expect_message(
result <- add_horizon(filled, horizon = 7),
"Forecasts accumulated every 7 days"

0 comments on commit bcbf8a3

Please sign in to comment.