Skip to content

Commit

Permalink
added load_spatial unit test (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul-Carvalho authored May 9, 2024
1 parent 7910750 commit b6f6986
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ locproject <- function() {

} else {
# have user select folder
proj_dir <- loc()
proj_dir <- loc()
}

# add trailing slash
Expand Down
8 changes: 8 additions & 0 deletions tests/testthat/test-data_parser.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,12 @@ test_that("Test loading main data works", {
expect_error(load_maindata(dat = FishSET::scallop, over_write = TRUE, project = "test load"))
expect_error(load_maindata(dat = FishSET::scallop, over_write = TRUE, project = ""))
expect_error(load_maindata(dat = cbind(FishSET::scallop, FishSET::scallop), over_write = TRUE, project = "testload"))
})

# Test load_spatial
test_that("Test loading spatial data works", {
# Note: unable to test successful upload due to the use of rstudioapi package
# Make sure project names that violate rules throw errors
expect_error(load_spatial(spat = FishSET::tenMNSQR, over_write = TRUE, project = "testload", name = "spat name"))
expect_error(load_spatial(spat = FishSET::tenMNSQR, over_write = TRUE, project = "testload", name = ""))
})

0 comments on commit b6f6986

Please sign in to comment.