Skip to content

Commit

Permalink
Merge pull request #17 from panukatan/dev
Browse files Browse the repository at this point in the history
add unit tests
  • Loading branch information
ernestguevarra authored Apr 1, 2024
2 parents bd3a6cd + deed6ec commit ae04e4f
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
2 changes: 2 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Suggests:
dplyr,
pdftools,
spelling,
testthat (>= 3.0.0),
tibble
Encoding: UTF-8
Language: en-GB
Expand All @@ -32,3 +33,4 @@ RoxygenNote: 7.3.1
Roxygen: list(markdown = TRUE)
URL: https://panukatan.io/bagyo/, https://github.com/panukatan/bagyo
BugReports: https://github.com/panukatan/bagyo/issues
Config/testthat/edition: 3
Binary file modified man/figures/README-barplot-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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(bagyo)

test_check("bagyo")
11 changes: 11 additions & 0 deletions tests/testthat/test-data.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Tests for data ---------------------------------------------------------------

testthat::expect_s3_class(tropical_cyclones, "data.frame")

testthat::expect_named(
tropical_cyclones,
expected = c("year", "category_code", "category_name", "name", "rsmc_name",
"start", "end", "pressure", "speed")
)

testthat::expect_contains(tropical_cyclones$year, 2017:2020)

0 comments on commit ae04e4f

Please sign in to comment.