tests/testthat/test-utils.R

# Tests for internal utility functions in utils.R

# Tests for .validate_and_normalize_path() --------------------------------

test_that(".validate_and_normalize_path returns normalized path for valid directory", {
  tmp_dir <- withr::local_tempdir()
  result <- froggeR:::.validate_and_normalize_path(tmp_dir)

  expect_type(result, "character")
  expect_true(dir.exists(result))
})

test_that(".validate_and_normalize_path errors on NULL path", {
  expect_error(
    froggeR:::.validate_and_normalize_path(NULL),
    class = "froggeR_invalid_path"
  )
})

test_that(".validate_and_normalize_path errors on NA path", {
  expect_error(
    froggeR:::.validate_and_normalize_path(NA_character_),
    class = "froggeR_invalid_path"
  )
})

test_that(".validate_and_normalize_path errors on nonexistent directory", {
  expect_error(
    froggeR:::.validate_and_normalize_path("/nonexistent/path/that/does/not/exist"),
    class = "froggeR_invalid_path"
  )
})

Try the froggeR package in your browser

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

froggeR documentation built on March 17, 2026, 9:06 a.m.