From 56c6f92952cf860db8d0697989bbe68e283a95e5 Mon Sep 17 00:00:00 2001 From: fawda123 Date: Tue, 7 Nov 2023 07:57:34 -0500 Subject: [PATCH] error tests in checkMWRfrecome check messages --- tests/testthat/test-checkMWRfrecom.R | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/testthat/test-checkMWRfrecom.R b/tests/testthat/test-checkMWRfrecom.R index 0b2a79f2..bee3a19e 100644 --- a/tests/testthat/test-checkMWRfrecom.R +++ b/tests/testthat/test-checkMWRfrecom.R @@ -1,38 +1,38 @@ test_that("Checking column name spelling", { chk <- frecomdatchk names(chk)[c(1, 3)] <- c('Variables', 'Lab Duplciate') - expect_error(checkMWRfrecom(chk)) + expect_error(checkMWRfrecom(chk), 'Please correct the column names or remove: Variables, Lab Duplciate', fixed = T) }) test_that("Checking required column names are present", { chk <- frecomdatchk chk <- chk[, -7] - expect_error(checkMWRfrecom(chk)) + expect_error(checkMWRfrecom(chk), 'Missing the following columns: % Completeness', fixed = T) }) test_that("Checking non-numeric values", { chk <- frecomdatchk chk$`Lab Duplicate` <- as.character(chk$`Lab Duplicate`) chk$`Lab Blank` <- as.character(chk$`Lab Blank`) - expect_error(checkMWRfrecom(chk)) + expect_error(checkMWRfrecom(chk), 'Non-numeric values found in columns: Lab Duplicate, Lab Blank', fixed = T) }) test_that("Checking values outside of 0 - 100", { chk <- frecomdatchk chk[2, 4] <- -10 chk[2, 6] <- 101 - expect_error(checkMWRfrecom(chk)) + expect_error(checkMWRfrecom(chk), 'Values less than 0 or greater than 100 found in columns: Field Blank, Spike/Check Accuracy', fixed = T) }) test_that("Checking correct Parameters", { chk <- frecomdatchk chk[4, 1] <- 'chla' chk[7, 1] <- 'ortho-p' - expect_error(checkMWRfrecom(chk)) + expect_error(checkMWRfrecom(chk), 'Incorrect Parameter found: chla, ortho-p in row(s) 4, 7', fixed = T) }) test_that("Checking empty column", { chk <- frecomdatchk chk[[4]] <- NA - expect_warning(checkMWRfrecom(chk)) + expect_warning(checkMWRfrecom(chk), 'Empty or all na columns found: Field Blank') })