Skip to content

Commit

Permalink
error tests in checkMWRacc check messages
Browse files Browse the repository at this point in the history
  • Loading branch information
fawda123 committed Nov 7, 2023
1 parent 4acb35d commit b0d2863
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/testthat/test-checkMWRacc.R
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
test_that("Checking column name spelling", {
chk <- accdatchk
names(chk)[c(1, 4)] <- c('Variables', 'AQL')
expect_error(checkMWRacc(chk))
expect_error(checkMWRacc(chk), 'Please correct the column names or remove: Variables, AQL', fixed = T)
})

test_that("Checking required column names are present", {
chk <- accdatchk
chk <- chk[, -10]
expect_error(checkMWRacc(chk))
expect_error(checkMWRacc(chk), 'Missing the following columns: Spike/Check Accuracy', fixed = T)
})

test_that("Checking column types, including NA", {
Expand Down Expand Up @@ -61,21 +61,21 @@ test_that("Checking missing entries in uom", {
test_that("Checking more than one unit type per parameter", {
chk <- accdatchk
chk[4, 2] <- 'ug/l'
expect_error(checkMWRacc(chk))
expect_error(checkMWRacc(chk), 'More than one unit (uom) found for Parameter: DO: mg/l, ug/l', fixed = T)
})

test_that("Checking correct Parameters", {
chk <- accdatchk
chk[7, 1] <- 'tss'
chk[5, 1] <- 'sp-conductivity'
expect_error(checkMWRacc(chk))
expect_warning(expect_error(checkMWRacc(chk), 'Incorrect Parameter found: sp-conductivity, tss in row(s) 5, 7', fixed = T))
})

test_that("Checking incorrect unit type per parameter", {
chk <- accdatchk
chk[chk$`Parameter` == 'Chl a', 2] <- 'micrograms/L'
chk[chk$`Parameter` == 'Water Temp', 2] <- 'celsius'
chk[chk$`Parameter` == 'TP', 2] <- 'mg/L'
expect_error(checkMWRacc(chk))
expect_error(checkMWRacc(chk), 'Incorrect units (uom) found for Parameters: Water Temp: celsius, TP: mg/L', fixed = T)
})

test_that("Checking empty column", {
Expand Down

0 comments on commit b0d2863

Please sign in to comment.