tests/testthat/test-fredr_category.R

test_that("fredr_category()", {
  skip_if_no_key()

  ctg <- fredr_category(category_id = 0)

  expect_s3_class(ctg, c("tbl_df", "tbl", "data.frame"))
  expect_true(ncol(ctg) == 3)
  expect_true(nrow(ctg) == 1)
})

test_that("input is validated", {
  expect_error(fredr_category(category_id = NULL))
  expect_error(fredr_category(category_id = "a"))
  expect_error(fredr_category(category_id = 1:2))
})

Try the fredr package in your browser

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

fredr documentation built on Jan. 30, 2021, 1:06 a.m.