Skip to content

Commit

Permalink
restore coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
wlandau-lilly committed Aug 22, 2023
1 parent 2459c1b commit 391b290
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions tests/testthat/test-class_database.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,14 @@ tar_test("database$set_row()", {
})

tar_test("database$get_data()", {
db <- database_init()
db <- database_init(
header = c("name", "x"),
list_columns = "x",
list_column_modes = "character"
)
expect_equal(db$memory$names, character(0))
row1 <- list(name = "abc", string = "123")
row2 <- list(name = "xyz", string = "456")
row1 <- list(name = "abc", x = "123")
row2 <- list(name = "xyz")
db$set_row(row1)
db$set_row(row2)
out <- db$get_data()
Expand All @@ -36,6 +40,23 @@ tar_test("database$get_data()", {
expect_false(file.exists(db$path))
})

tar_test("database$get_data() with list columns", {
skip_cran()
pipeline <- pipeline_map()
algorithm <- local_init(pipeline)
algorithm$run()
out <- algorithm$meta$database$get_data()
expect_true(is.list(out$path))
expect_true(is.list(out$children))
expect_equal(
length(out$children[[which(out$name == "map1")]][[1L]]),
3L
)
expect_false(anyNA(out$name))
expect_true(all(nzchar(out$name)))
expect_equal(as.integer(anyDuplicated(out$name)), 0L)
})

tar_test("database$ensure_storage()", {
out <- database_init(header = c("col1", "col2"))
path <- out$path
Expand Down

0 comments on commit 391b290

Please sign in to comment.