Skip to content

test: add a testthat suite and CI - #17

Merged
eliotmcintire merged 2 commits into
developmentfrom
feat/add-testthat-ci
Sep 11, 2026
Merged

eliotmcintire merged 2 commits into
developmentfrom
feat/add-testthat-ci

Conversation

@eliotmcintire

Copy link
Copy Markdown
Collaborator

Adds a testthat suite and CI to this module, as piloted on PredictiveEcology/fireSense_EscapeFit#4.

What's added

  • .github/workflows/testthat-module.yaml calls the shared testthat-module workflow (Add testthat-module reusable workflow actions#44). It installs the module's reqdPkgs, converts the module into a package in a throwaway directory with convertToPackage(destinationPath = ), runs tests/testthat, and writes coverage to the job summary. Nothing is committed back.
  • tests/testthat/setup.R is actions' examples/module-tests-setup.R: options, moduleName / modulePath, and a temporary directory tree.
  • tests/testthat/test-metadata.R asserts the declared inputs and outputs (names and classes) and the parameter names, which together are the module's public contract. It was generated from the module's own metadata rather than typed. A deliberate change to any of these should update this file in the same commit, with a matching version bump.
  • The newModule() scaffolding (tests/testthat/test-template.R, tests/unitTests.R) is removed.

Also fixes a metadata error (separate commit). fireSense_igAndEscapePred_Covariates was declared c("data.table", "SpatRaser"). The second class is misspelt, and there is no SpatRaster path behind it: IgnitionPredictRun() uses the object only as a data.table (copy(), igCov$pixelID, set(), predict(newdata = )), and its only producer, fireSense_dataPrepPredict, creates a data.table. Checked in R: a SpatRaster fails at igCov$pixelID ([subset] invalid name(s)) and at set(). It is now declared "data.table", and the description says so; the metadata test snapshots the corrected class.

Verified locally: testthat::test_dir("tests/testthat") passes (R 4.6.1, SpaDES.core 3.2.0, fireSenseUtils 0.2.3.9003). That goes through the module file directly; this PR's testthat-module run is the check on the package-conversion path.

🤖 Generated with Claude Code

https://claude.ai/code/session_0133867aFrmKtbhpNXasToP9

eliotmcintire and others added 2 commits September 10, 2026 11:40
The input was declared c("data.table", "SpatRaser"). The second class is
misspelt, and there is no SpatRaster path behind it: IgnitionPredictRun()
uses the object only as a data.table (copy(), igCov$pixelID, set(),
predict(newdata = )), and its only producer, fireSense_dataPrepPredict,
creates a data.table. A SpatRaster fails at igCov$pixelID.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0133867aFrmKtbhpNXasToP9
- .github/workflows/testthat-module.yaml calls the shared
  PredictiveEcology/actions testthat-module workflow (@main), which tests
  the module as a package via convertToPackage(destinationPath =).
- tests/testthat/setup.R is actions' examples/module-tests-setup.R.
- tests/testthat/test-metadata.R asserts the declared inputs and outputs
  (names and classes) and parameter names -- the module's public contract.
  Generated from the module's own metadata, not typed.
- Removes the newModule() scaffolding (tests/testthat/test-template.R,
  tests/unitTests.R), which asserted nothing about this module.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0133867aFrmKtbhpNXasToP9
@eliotmcintire
eliotmcintire merged commit 1bd6d0c into development Sep 11, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant