tests/testthat/test_research_briefings.R

library(hansard)
context("research_briefings")


test_that("research_briefings return expected format", {
  skip_on_cran()
  skip_on_travis()

  rtl <- hansard_research_topics_list()
  expect_is(rtl, "list")
  # expect_length(rtl, 20)

  rsl <- hansard_research_subtopics_list()
  expect_is(rsl, "list")
  # expect_length(rsl, 20)

  rtyl <- hansard_research_types_list()
  expect_is(rtyl, "list")
  # expect_length(rtyl, 6)

  rbdf <- hansard_research_briefings(
    subtopic = "Falkland Islands",
    verbose = TRUE
  )
  expect_length(rbdf, 14)
  expect_true(tibble::is_tibble(rbdf))

  rbtsb <- hansard_research_briefings(
    topic = "Defence",
    subtopic = "Falkland Islands",
    verbose = TRUE
  )
  # expect_length(rbtsb, 14)
  expect_true(tibble::is_tibble(rbtsb))
  expect_true(rbdf[[1]][[1]] == rbtsb[[1]][[1]])
})

Try the hansard package in your browser

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

hansard documentation built on Nov. 13, 2019, 5:06 p.m.