tests/testthat/test-deploy-site.R

# ci_commit_sha() ------------------------------------------------------------

test_that("commit sha can be retrieved from travis or GitHub action env vars", {
  sha <- "XYZ"

  withr::with_envvar(
    c("TRAVIS_COMMIT" = sha, "GITHUB_SHA" = ""),
    expect_equal(ci_commit_sha(), sha)
  )
  withr::with_envvar(
    c("TRAVIS_COMMIT" = "", "GITHUB_SHA" = sha),
    expect_equal(ci_commit_sha(), sha)
  )
  withr::with_envvar(
    c("TRAVIS_COMMIT" = "", "GITHUB_SHA" = ""),
    expect_equal(ci_commit_sha(), "")
  )
})

Try the pkgdown package in your browser

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

pkgdown documentation built on Dec. 28, 2022, 1:37 a.m.