From e092f7848faf6fe4bae66d0b5d32101eb915a64b Mon Sep 17 00:00:00 2001 From: fawda123 Date: Wed, 25 Sep 2024 10:57:13 -0400 Subject: [PATCH] expanding test coverage for anlz_fibmatrix --- tests/testthat/test-anlz_fibmatrix.R | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/testthat/test-anlz_fibmatrix.R b/tests/testthat/test-anlz_fibmatrix.R index daf17b5d..79334004 100644 --- a/tests/testthat/test-anlz_fibmatrix.R +++ b/tests/testthat/test-anlz_fibmatrix.R @@ -116,3 +116,23 @@ test_that("Check error if bay segment is not null for epchc data", { fixed = T) }) + +test_that("Checking anlz_fibmatrix if bay segment is not null for non-epchc data", { + result <- anlz_fibmatrix(enterodata, indic = 'entero', bay_segment = 'HB') + expect_true('HB' %in% result$grp) +}) + +test_that("Checking anlz_fibmatrix if bay segment is null and stas is null for non-epchc data", { + result <- anlz_fibmatrix(enterodata, indic = 'entero') + expect_true(any(grepl('FLHILL', result$grp))) +}) + +test_that("Checking anlz_fibmatrix yrrng[1] as NA", { + result <- anlz_fibmatrix(fibdata, indic = 'fcolif', yrrng = c(NA, 2010)) + expect_true(min(result$yr) < 2010) +}) + +test_that("Checking anlz_fibmatrix yrrng[2] as NA", { + result <- anlz_fibmatrix(fibdata, indic = 'fcolif', yrrng = c(2010, NA)) + expect_true(max(result$yr) > 2010) +})