Skip to content

Commit

Permalink
test: reorganize and complete test-info.R
Browse files Browse the repository at this point in the history
  • Loading branch information
maelle committed Feb 28, 2024
1 parent db36e14 commit a240fad
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
9 changes: 9 additions & 0 deletions tests/testthat/_snaps/info.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# emodnet_get_wfs_info() errors well

Code
emodnet_get_wfs_info()
Condition
Error:
! Please provide a valid service name or wfs object.
x Both cannot be "NULL" at the same time.

10 changes: 7 additions & 3 deletions tests/testthat/test-info.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
test_that("wfs all info works", {
test_that("emodnet_get_all_wfs_info() works", {
forget_all()
skip_if_offline()
all_info <- emodnet_get_all_wfs_info()
Expand All @@ -7,7 +7,7 @@ test_that("wfs all info works", {
expect_setequal(unique(all_info$service_name), emodnet_wfs()$service_name)
})

test_that("wfs info works on wfs object", {
test_that("emodnet_get_wfs_info() works on wfs object", {
forget_all()
skip_if_offline()
wfs <- create_biology_wfs()
Expand All @@ -21,7 +21,7 @@ test_that("wfs info works on wfs object", {
expect_identical(unique(layer_info_all$service_url), "https://geo.vliz.be/geoserver/Emodnetbio/wfs") # nolint
})

test_that("emodnet_get_layer_info works", {
test_that("emodnet_get_layer_info() works", {
skip_if_offline()
wfs <- create_biology_wfs()
with_mock_dir("biology-info", {
Expand All @@ -37,3 +37,7 @@ test_that("emodnet_get_layer_info works", {
class = c("tbl_df", "tbl", "data.frame")
)
})

test_that("emodnet_get_wfs_info() errors well", {
expect_snapshot(emodnet_get_wfs_info(), error = TRUE)
})

0 comments on commit a240fad

Please sign in to comment.