tests/testthat/test-reset.R

test_that("reset", {
  sbf_reset()
  sbf_set_main(file.path(withr::local_tempdir(), "output"))
  withr::defer(sbf_reset())

  sbf_set_main("output2")
  sbf_set_sub("sub2")
  sbf_set_db_name("database2")

  expect_identical(sbf_get_main(), "output2")
  expect_identical(sbf_get_sub(), "sub2")
  expect_identical(sbf_get_db_name(), "database2")

  expect_null(sbf_reset())

  expect_identical(sbf_get_main(), "output")
  expect_identical(sbf_get_sub(), character(0))
  expect_identical(sbf_get_db_name(), "database")
})
poissonconsulting/subfoldr2 documentation built on Nov. 17, 2024, 1:33 a.m.