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)

})

Try the newscatcheR package in your browser

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

newscatcheR documentation built on Sept. 20, 2023, 5:07 p.m.