R/test-helpers.R

Defines functions expect_snapshot_data save_csv

save_csv <- function(x) {
  path <- tempfile(fileext = ".csv")
  readr::write_csv(x, path)
  path
}

expect_snapshot_data <- function(x, name) {
  x <- tibble::as_tibble(x)
  x$geometry <- NULL
  testthat::skip_on_os("windows")
  path <- save_csv(x)
  testthat::expect_snapshot_file(path, paste0(name, ".csv"))
}
poissonconsulting/pgfsr documentation built on Nov. 4, 2024, 4:02 p.m.