test_that("create_summary_df() creates the summary df", {
# Clear any leftover environmental variables from earlier tests
Sys.unsetenv("R_DJPRLABOURDASH_TABLEDEST")
df <- create_summary_df(data = filter_dash_data(c(
"A84423349V",
"A84423357V",
"A84423356T",
"A84423244X",
"A84423468K",
"pt_emp_vic"
)) %>% dplyr::filter(.data$date <= as.Date("2022-05-02")))
expect_s3_class(df, "data.frame")
expect_equal(ncol(df), 8)
columns <- colnames(df)
expect_equal(
columns,
c(
"indicator",
"Last 3 years",
"series_id",
"May 2022",
"Since Apr 2022",
"Since May 2021",
"Since Mar 2020",
"Since Nov 2014"
)
)
expect_type(df$indicator, "character")
expect_type(df$series_id, "character")
expect_type(df$`May 2022`, "character")
expect_type(df$`Since Apr 2022`, "character")
expect_type(df$`Since May 2021`, "character")
expect_type(df$`Since Nov 2014`, "character")
})
test_that("create_summary_df() works with data that starts after Nov 2014", {
df <- create_summary_df(
data = filter_dash_data(series_ids = c(
"A84423354L",
"A84423242V",
"A84423466F"
)) %>%
filter(.data$date >= as.Date("2015-01-01"))
)
expect_s3_class(df, "data.frame")
expect_equal(ncol(df), 8)
expect_equal(df$`Since Nov 2014`[1], "-")
expect_equal(df$`Since Nov 2014`[2], "-")
expect_equal(df$`Since Nov 2014`[3], "-")
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.