tests/testthat/test-list_datasets.R

skip_if_offline(host = "www.opendata.nhs.scot")

test_that("returns more than 0 datasets", {
  expect_gte(nrow(list_datasets()), 1)
})

test_that("returns data in the expected format", {
  data <- list_datasets()

  expect_s3_class(data, "tbl_df")
  expect_named(data, "name")
  expect_equal(dplyr::n_distinct(data[["name"]]), nrow(data))
})

Try the phsopendata package in your browser

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

phsopendata documentation built on Sept. 1, 2025, 5:10 p.m.