diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index ed7650c..b7a5210 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -2,12 +2,7 @@ # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help on: push: - branches: [main, master] - pull_request: - branches: [main, master] - release: - types: [published] - workflow_dispatch: + branches: [main] name: pkgdown diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml new file mode 100644 index 0000000..456af27 --- /dev/null +++ b/.github/workflows/tests.yaml @@ -0,0 +1,36 @@ +on: + pull_request: + branches: + - main + +name: Unit testing + +jobs: + r_cmd_check: + name: R CMD check + runs-on: ubuntu-latests + steps: + - uses: actions/checkout@v3 + - uses: r-lib/actions/setup-r@v2 + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::rcmdcheck + needs: check + - uses: r-lib/actions/check-r-package@v2 + with: + error-on: '"error"' + r_cmd_check_as_cran: + name: R CMD check as CRAN + runs-on: ubuntu-latests + steps: + - uses: actions/checkout@v3 + - uses: r-lib/actions/setup-r@v2 + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::rcmdcheck + needs: check + - uses: r-lib/actions/check-r-package@v2 + with: + args: 'c("--no-manual", "--as-cran")' + error-on: '"error"' + check-dir: '"check"' diff --git a/DESCRIPTION b/DESCRIPTION index 1ca12e2..2c73594 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -31,5 +31,7 @@ Imports: Suggests: knitr, rmarkdown, - shiny + shiny, + testthat (>= 3.0.0) VignetteBuilder: knitr +Config/testthat/edition: 3 diff --git a/tests/testthat.R b/tests/testthat.R new file mode 100644 index 0000000..9a18897 --- /dev/null +++ b/tests/testthat.R @@ -0,0 +1,12 @@ +# This file is part of the standard setup for testthat. +# It is recommended that you do not modify it. +# +# Where should you do additional test configuration? +# Learn more about the roles of various files in: +# * https://r-pkgs.org/testing-design.html#sec-tests-files-overview +# * https://testthat.r-lib.org/articles/special-files.html + +library(testthat) +library(tapLock) + +test_check("tapLock") diff --git a/tests/testthat/test-parse_cookies.R b/tests/testthat/test-parse_cookies.R new file mode 100644 index 0000000..024e78d --- /dev/null +++ b/tests/testthat/test-parse_cookies.R @@ -0,0 +1,6 @@ +test_that("coorkie parsing works!", { + EXAMPLE_COOKIE <- "foo=bar; baz=quux" + EXPECTED_RESULT <- list(foo = "bar", baz = "quux") + result <- parse_cookies(EXAMPLE_COOKIE) + testthat::expect_equal(result, EXPECTED_RESULT) +})