tests/testthat/test-resource_names.R

test_that("resource_names() returns a character vector of resource names", {
  p <- example_package()
  expect_identical(resource_names(p), c("deployments", "observations", "media"))

  # 1 resource
  p <- remove_resource(p, "media")
  p <- remove_resource(p, "observations")
  expect_identical(resource_names(p), c("deployments"))

  # 0 resources
  p <- remove_resource(p, "deployments")
  expect_identical(resource_names(p), character(0))
})

test_that("resource_names() returns error if resources have no name", {
  p <- example_package()
  p$resources[[2]]$name <- NULL
  expect_error(
    resource_names(p),
    class = "frictionless_error_resources_without_name"
  )

  # For more tests see test-check_package.R
})

Try the frictionless package in your browser

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

frictionless documentation built on July 31, 2026, 9:06 a.m.