From a240fad4ebc5941335a9353724e364972b635b98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABlle=20Salmon?= Date: Wed, 28 Feb 2024 13:56:44 +0100 Subject: [PATCH] test: reorganize and complete test-info.R --- tests/testthat/_snaps/info.md | 9 +++++++++ tests/testthat/test-info.R | 10 +++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 tests/testthat/_snaps/info.md diff --git a/tests/testthat/_snaps/info.md b/tests/testthat/_snaps/info.md new file mode 100644 index 0000000..8fa1e84 --- /dev/null +++ b/tests/testthat/_snaps/info.md @@ -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. + diff --git a/tests/testthat/test-info.R b/tests/testthat/test-info.R index 8fef510..43b4c8c 100644 --- a/tests/testthat/test-info.R +++ b/tests/testthat/test-info.R @@ -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() @@ -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() @@ -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", { @@ -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) +})