tests/testthat/test-answers.R

library(testthat)
library(whatr)

id <- sample(whatr::episodes$game, 1)
test_that("answers return from HTML", {
  a <- whatr_html(id) %>% whatr_answers()
  expect_s3_class(a, "tbl")
  expect_length(a, 5)
  Sys.sleep(runif(1, 5, 10))
})

test_that("answers return from game ID", {
  a <- whatr_answers(game = id)
  expect_s3_class(a, "tbl")
  expect_length(a, 5)
  Sys.sleep(runif(1, 5, 10))
})

Try the whatr package in your browser

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

whatr documentation built on July 29, 2020, 5:06 p.m.