Skip to content

Commit

Permalink
add missing package to description, add extra package to test docker,…
Browse files Browse the repository at this point in the history
… add single model running test
  • Loading branch information
hillalex committed Oct 7, 2024
1 parent e5c95f0 commit 4940197
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.1
Imports:
cmdstanr,
data.table,
forcats,
fs,
Expand Down
1 change: 1 addition & 0 deletions snapshot-tests.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ WORKDIR /epikinetics
COPY DESCRIPTION /epikinetics

RUN Rscript -e "devtools::install_deps()"
RUN Rscript -e "install.packages('decor')"

COPY . /epikinetics
COPY tests/snapshots/test-snapshots.R /epikinetics/tests/testthat
Expand Down
9 changes: 9 additions & 0 deletions tests/testthat/test-run-model.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ mock_model_no_covariates <- function(name, package) {
list(sample = function(x, ...) readRDS(test_path("testdata", "testdraws_nocovariates.rds")))
}

test_that("Can run model", {
dat <- data.table::fread(system.file("delta_full.rds", package = "epikinetics"))
mod <- biokinetics$new(data = dat, covariate_formula = ~0 + infection_history)
delta <- mod$fit(parallel_chains = 4,
iter_warmup = 10,
iter_sampling = 100)
expect_equal(class(delta), c("CmdStanMCMC", "CmdStanFit", "R6"))
})

test_that("Can fit model with arguments", {
local_mocked_bindings(
stan_package_model = mock_model_return_args, .package = "instantiate"
Expand Down

0 comments on commit 4940197

Please sign in to comment.