tests/testthat/test-matomo_token.R

test_that("the token is read correctly", {
  Sys.setenv(MATOMO_TOKEN = "anonymous")
  expect_equal(matomo_token(), "anonymous")
})

test_that("an error is thrown when the token is not set", {
  Sys.unsetenv("MATOMO_TOKEN")
  expect_error(matomo_token())
})
ebbertd/matomoR documentation built on Oct. 25, 2021, 2:09 p.m.