tests/testthat/test-read_timber.R

test_that("read_timber: Read .CSV works", {
  write_tibble_to_csv <- function(timber, mill_step) {
    path <- mill_step
    readr::write_csv(timber, path)
    return(path)
  }

  name <- "read_timber"
  test_file <- paste0(
    "test-",
    name,
    ".csv"
  )

  expect_snapshot_csv <- function(code, name) {
    name <- paste0(name, ".csv")
    announce_snapshot_file(name = name)

    path <- write_tibble_to_csv(code, name)
    expect_snapshot_file(path, name)
  }

  expect_snapshot_csv(suppressMessages(read_timber(test_file)), name)
})
iAM-AMR/sawmill documentation built on June 30, 2024, 2:25 a.m.