Skip to content

Commit 5e9f659

Browse files
committed
fix date type in test
1 parent 2976588 commit 5e9f659

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

backfill_corrections/delphiBackfillCorrection/unit-tests/testthat/test-preprocessing.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,15 @@ test_that("testing NA filling for missing udpates", {
5050
test_that("testing the calculation of 7-day moving average", {
5151
df_new <- fill_rows(fake_df, refd_col, lag_col, min_refd, max_refd, ref_lag)
5252
df <- fill_missing_updates(df_new, value_col, refd_col, lag_col)
53-
df$issue_date <- df[[refd_col]] + df[[lag_col]]
53+
df$issue_date <- as.Date(df[[refd_col]]) + df[[lag_col]]
5454
pivot_df <- df[order(df$issue_date, decreasing=FALSE), ] %>%
5555
pivot_wider(id_cols=refd_col, names_from="issue_date",
5656
values_from="value_raw")
5757
pivot_df[is.na(pivot_df)] = 0
5858
backfill_df <- get_7dav(pivot_df, refd_col)
5959

6060

61-
output <- backfill_df[backfill_df[[refd_col]] == as.Date("2022-01-07"), "value_raw"]
61+
output <- backfill_df[backfill_df[[refd_col]] == "2022-01-07", "value_raw"]
6262
expected <- colSums(pivot_df[, -1]) / 7
6363
expect_true(all(output == expected))
6464
})

0 commit comments

Comments
 (0)