Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
realxinzhao committed Nov 8, 2023
1 parent fcb1121 commit ebe6ce6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
5 changes: 2 additions & 3 deletions tests/testthat/test_driver_drake.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@ context("driver_drake")
hasdrake <- FALSE
if(require('drake')){
hasdrake <- TRUE
test_cache <- new_cache()
# test_cache <- new_cache()
}
xml_dir <- paste0(normalizePath(file.path("../..", XML_DIR), winslash = "/"), "/" )

test_that("driver_drake runs with no errors",{
if(!hasdrake) {
skip("No drake package - skipping test")
}
expect_error(driver_drake(stop_after = c("module_xfaostat_L103_ProducerPrices"), xmldir = xml_dir, cache = test_cache), NA)
expect_error(driver_drake(stop_after = c("module_xfaostat_L103_ProducerPrices"), xmldir = "./", cache = ""))
})

test_that("catches bad input", {
Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/test_helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
context("helpers")

test_that("left_join_error_no_match works", {
d1 <- tibble(X = LETTERS[1:3], Y = 1:3)
d2 <- tibble(X = d1$X, Z = 4:6)
d1 <- tibble::tibble(X = LETTERS[1:3], Y = 1:3)
d2 <- tibble::tibble(X = d1$X, Z = 4:6)

# Bad data
expect_error(left_join_error_no_match(1))
Expand All @@ -19,7 +19,7 @@ test_that("left_join_error_no_match works", {
# Incomplete merge data
d2$Z[2] <- NA
expect_error(left_join_error_no_match(d1, d2))
d2 <- tibble(X = d1$X[1:2], Z = 4:5)
d2 <- tibble::tibble(X = d1$X[1:2], Z = 4:5)
expect_error(left_join_error_no_match(d1, d2))
})

Expand Down

0 comments on commit ebe6ce6

Please sign in to comment.