tests/testthat/test-check_dataset_name.R

test_that("errors for incorrect case", {
  expect_error(
    check_dataset_name("hospital codes"),
    regexp = "dataset_name must be in dash-case"
  )
})

test_that("errors for incorrect type", {
  expect_error(
    check_dataset_name(20),
    regexp = "dataset_name must be of type character"
  )
})

test_that("returns nothing for valid type and format", {
  expect_equal(
    check_dataset_name("hospital-codes"),
    NULL
  )
})

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.