Skip to content

Commit

Permalink
Adds unit testing workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
andyquinterom committed Jan 4, 2024
1 parent b2561d8 commit 390f87b
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 7 deletions.
7 changes: 1 addition & 6 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -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"'
4 changes: 3 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,7 @@ Imports:
Suggests:
knitr,
rmarkdown,
shiny
shiny,
testthat (>= 3.0.0)
VignetteBuilder: knitr
Config/testthat/edition: 3
12 changes: 12 additions & 0 deletions tests/testthat.R
Original file line number Diff line number Diff line change
@@ -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")
6 changes: 6 additions & 0 deletions tests/testthat/test-parse_cookies.R
Original file line number Diff line number Diff line change
@@ -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)
})

0 comments on commit 390f87b

Please sign in to comment.