tests/testthat/test-create.R

test_that("default cookie location as described in docs", {
  expect_equal(
    default_jar(),
    rappdirs::user_cache_dir("r_cookies")
  )
})

test_that("getting cookies works", {
  jar <- options(cookie_dir = tempdir())

  expect_false(file.exists(file.path(tempdir(), paste0("cookies.rds"))))
  add_cookies(cookiestring = "test=true", domain = "https://create.com", confirm = TRUE)
  expect_true(file.exists(file.path(tempdir(), paste0("cookies.rds"))))
})

Try the cookiemonster package in your browser

Any scripts or data that you put into this service are public.

cookiemonster documentation built on May 29, 2024, 8:12 a.m.