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 9c5ce7a
Show file tree
Hide file tree
Showing 5 changed files with 40 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
18 changes: 18 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
on:
pull_request:
branches:
- main

name: Unit testing

jobs:
run_unit_tests:
runs-on: ubuntu-latests
steps:
- uses: actions/checkout@v3
- name: Install system dependencies
run: apt-get install -y libcurl-dev r-base
- name: Build package
run: R CMD build .
- name: Check package
run: R CMD check *.tar.gz
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 9c5ce7a

Please sign in to comment.