From fb477ef7b5a57cba326da1f331edcebb44e164b5 Mon Sep 17 00:00:00 2001 From: Pieter Huybrechts <48065851+PietrH@users.noreply.github.com> Date: Mon, 6 Nov 2023 11:37:54 +0100 Subject: [PATCH] split off test, skip if no NA in deployments.csv --- tests/testthat/test-read_camtrap_dp.R | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tests/testthat/test-read_camtrap_dp.R b/tests/testthat/test-read_camtrap_dp.R index 4a23de73..a61eccd6 100644 --- a/tests/testthat/test-read_camtrap_dp.R +++ b/tests/testthat/test-read_camtrap_dp.R @@ -343,11 +343,23 @@ test_that( expect_identical( levels(dp_v1_with_media$data$deployments$baitUse), baitUse_levels ) - # boolean NA becomes a factor NA - expect_true(all(is.na(dp_v1_with_media$data$deployments$baitUse))) } ) +test_that("read deployments v1.0: boolean NA becomes a factor NA", { + ## no longer present in the example package! + skip_if_not(any(is.na( + readr::read_csv( + file.path(dirname(path_to_json_v1), "deployments.csv"), + show_col_types = FALSE, + col_select = "baitUse" + ) + )), + message = "There are no NA values present in deployments.baitUse") + + expect_true(all(is.na(dp_v1_with_media$data$deployments$baitUse))) +}) + test_that("read deployments v1.0: session is left empty", { expect_true(all(is.na(dp_v1_with_media$data$deployments$session))) })