Skip to content

Commit 9b53a5e

Browse files
committed
test day of week, correct docs
1 parent c9f19fd commit 9b53a5e

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

R/model.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ parse_api_date <- function(value) {
256256

257257
#' parse_api_week converts an integer to a date
258258
#' @param value value to be converted to an epiweek
259-
#' @param reference_week_day the day of the week to use as the reference day. Defaults to Saturday.
259+
#' @param reference_week_day the day of the week to use as the reference day. Defaults to Sunday.
260260
#' @return a date
261261
#' @importFrom MMWRweek MMWRweek2Date
262262
#' @keywords internal

man/parse_api_week.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test-model.R

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,12 @@ test_that("parse_api_date handles missing values appropriately", {
148148
expect_identical(parse_api_date(NA), as.Date(NA))
149149
})
150150

151+
test_that("parse_api_week returns the expected day of the week", {
152+
expect_identical(parse_api_week(202005) %>% weekdays(), "Sunday")
153+
expect_identical(parse_api_week(202005, 4) %>% weekdays(), "Wednesday")
154+
expect_identical(parse_api_week(202005, 7) %>% weekdays(), "Saturday")
155+
})
156+
151157
test_that("date_to_epiweek accepts str and int input", {
152158
expect_identical(date_to_epiweek("20200101"), 202001)
153159
expect_identical(date_to_epiweek(20200101), 202001)

0 commit comments

Comments
 (0)