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/osmextract documentation built on Nov. 27, 2024, 3:39 a.m.