tests/testthat/test-read_payrolls.R

test_that("read_payrolls() works", {
  skip_if_offline()
  skip_on_cran()

  check_payrolls <- function(series) {
    print(series)
    df <- read_payrolls(series)
    expect_is(df, "tbl_df")
    expect_is(df$date, "Date")
    expect_is(df$value, "numeric")
    expect_gt(ncol(df), 4)
    expect_gt(nrow(df), 1000)
    expect_false(any(grepl(" ", names(df))))
  }

  purrr::map(
    c(
      "industry_jobs",
      "industry_wages",
      "sa4_jobs",
      "sa3_jobs",
      "subindustry_jobs",
      "empsize_jobs",
      "gccsa_jobs"
    ),
    ~ check_payrolls(.x)
  )
})

Try the readabs package in your browser

Any scripts or data that you put into this service are public.

readabs documentation built on Dec. 17, 2021, 1:07 a.m.