tests/testthat/test-show_available_catalogues.r

test_that("show_available_catalogues() returns expected vector", {
  cats <- show_available_catalogues()

  expect_type(cats, "character")
  expect_gt(length(cats), 200)
  expect_equal(sort(cats), sort(abs_lookup_table$catalogue))

  filtered_cats <- show_available_catalogues(selected_heading = "Price indexes and inflation")

  expect_type(filtered_cats, "character")
  expect_gt(length(filtered_cats), 5)
})

test_that("show_available_catalogues(refresh = TRUE) returns tibble", {
  skip_on_cran()
  skip_if_offline()
  check_abs_connection()

  cats <- show_available_catalogues(refresh = TRUE)

  expect_type(cats, "character")
  expect_gt(length(cats), 200)
  expect_equal(
    sort(cats),
    sort(abs_lookup_table$catalogue)
  )
})

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.