tests/testthat/test-get_headlines.R

test_that("get_headlines returns a data frame with one column", {
  # adding a small time delay to avoid simultaneous posts to the api
  Sys.sleep(3)

  # Skip when tests are run on CRAN
  skip_on_cran()

  # Get the news
  output_headlines <- get_headlines("ycombinator.com")

  # What's returned
  expect_s3_class(output_headlines, "data.frame")
  expect_equal(ncol(output_headlines), 1)

})
discindo/newscatcheR documentation built on Sept. 28, 2023, 6:38 p.m.