Skip to content

Commit

Permalink
Test coverage #154
Browse files Browse the repository at this point in the history
  • Loading branch information
thekangaroofactory committed Jan 24, 2024
1 parent 228d727 commit 9dd88b1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/testthat/setup.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ default_val <- c("name" = "test", "isvalid" = TRUE)
default_fun <- c("date" = "Sys.Date")

# -- declare filter
filter <- c("id" = TRUE)
filter <- c("id")

# -- declare filter
skip <- c("isvalid" = TRUE)
skip <- c("isvalid")


# ------------------------------------------------------------------------------
Expand All @@ -26,6 +26,8 @@ skip <- c("isvalid" = TRUE)

# -- build data model
dm <- data_model(colClasses = colClasses, default.val = default_val, default.fun = default_fun, filter = filter, skip = skip)
dm_nofilter <- data_model(colClasses = colClasses, default.val = default_val, default.fun = default_fun, filter = NULL, skip = skip)


# -- items
items <- data.frame("id" = c(1705158971950, 1705313192780, 1705313216662, 1705399423521),
Expand Down
17 changes: 17 additions & 0 deletions tests/testthat/test-dm_apply_mask.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,21 @@ test_that("dm_apply_mask", {
# -- checks:
expect_output(str(res), "data.frame")

# -- check: output dim
expect_equal(dim(res), c(4,3))

})


test_that("dm_apply_mask: no filter", {

# -- function call
res <- dm_apply_mask(data.model = dm_nofilter, items = items)

# -- checks:
expect_output(str(res), "data.frame")

# -- check: output dim
expect_equal(dim(res), c(4,4))

})

0 comments on commit 9dd88b1

Please sign in to comment.