tests/testthat/test_prison_brief_tests.R

test_that("correct class", {
        xx <- prisonbrief::wpb_list()
        expect_is(xx, c("tbl_df", "tbl", "data.frame"))
})

# check right country is returned
test_that("correct country", {
        esp <- prisonbrief::wpb_series(country = "Spain")
        xy <- unique(esp$Country)
        expect_output(cat(xy), "spain")
})

# expect error
test_that("error returned from imaginary country", {
        expect_error(prisonbrief::wpb_series(country = "Weirdo Land"))
})

Try the prisonbrief package in your browser

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

prisonbrief documentation built on Feb. 18, 2021, 9:06 a.m.