tests/testthat/test-parameters.R

context("test-parameters")

APPDIR <- "../apps"
DATADIR <- "../data"

APP <- file.path(APPDIR, "working")
DATA <- file.path(DATADIR, "working_1")
PARAMS <- list(
    str_value="hello from parameters.json",
    int_value=150,
    float_value=100.0,
    bool_value=TRUE,
    list_value=list(3, 2, 1),
    dict_value=list(foo=42, bar="answer to everything"),
    optional_int_value_concrete=4,
    optional_int_value_null=NULL,
    enum_value="X"
)

Map(function(name){
    test_that(stringr::str_interp("Parameter loads: ${name}"), {
        process = fastgenomicsR::Process(app_dir=APP, data_dir=DATA)
        expect_equal(process@params[[name]], PARAMS[[name]])
    })}, names(PARAMS))

test_that(
    "List parameter is of list type",
    {
        process <- fastgenomicsR::Process(app_dir=APP, data_dir=DATA)
        expect_is(process@app@parameters@values[['list_value']], 'list')
        expect_is(process@params[['list_value']], 'list')
    }
)
FASTGenomics/fastgenomicsR documentation built on June 26, 2019, 12:38 p.m.