tests/testthat/test-utils.R

test_that("oe_clean removes all files in download_directory", {
  withr::defer(oe_clean(tempdir()))

  file.copy(
    from = system.file("its-example.osm.pbf", package = "osmextract"),
    to = file.path(tempdir(), "test_its-example.osm.pbf")
  )

  oe_clean(tempdir())

  expect_equal(
    object = list.files(tempdir(), "\\.(pbf|gpkg)$", full.names = TRUE),
    expected = character(0)
  )
})
ITSLeeds/osmextractr documentation built on Sept. 23, 2024, 3:37 a.m.