From 048e85c5e52c6b250f773c322f1813fd541edbd4 Mon Sep 17 00:00:00 2001 From: Bock <abock@usgs.gov> Date: Tue, 16 May 2023 16:55:14 -0600 Subject: [PATCH] more thorough testing of addType --- hyfabric/tests/testthat/test_poi_creation.R | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/hyfabric/tests/testthat/test_poi_creation.R b/hyfabric/tests/testthat/test_poi_creation.R index 2c337fa..d6cbb3d 100644 --- a/hyfabric/tests/testthat/test_poi_creation.R +++ b/hyfabric/tests/testthat/test_poi_creation.R @@ -16,18 +16,18 @@ test_that("poi_creation", { expect_equal(poi_out2$Type_CA_SO, "54321") - poi_out <- addType(poi_out2, poi_out, "CA_SO", nexus = FALSE) + poi_out_at1 <- addType(poi_out2, poi_out, "CA_SO", nexus = FALSE) + expect_equal(poi_out_at1$Type_CA_SO, c(NA, "54321")) - expect_equal(poi_out$Type_CA_SO, c(NA, "54321")) + poi_out_at2 <- addType(poi_out2, poi_out, "CA_SO", nexus = FALSE, bind = FALSE) + expect_equal(poi_out_at2$Type_CA_SO, c(NA)) poi <- data.frame(COMID = in_data$COMID[1], ID = "57681") + poi_out3 <- POI_creation(poi, in_data, "TE") + poi_out_at3 <- addType(poi_out3, poi_out, "TE", nexus = FALSE) + expect_equal(poi_out_at3$Type_TE, c("57681")) - poi_out3 <- POI_creation(poi, in_data, "TE") %>% - dplyr::mutate(nexus = FALSE) - - poi_out <- dplyr::mutate(poi_out, nexus = TRUE) - - poi_out_fin <- addType(poi_out3, poi_out, "TE", nexus = TRUE) - - expect_equal(poi_out_fin$nexus, c(FALSE, TRUE, TRUE)) + poi_out_at4 <- addType(mutate(poi_out3, nexus = TRUE), poi_out_at1, "TE", nexus = TRUE) + expect_equal(poi_out_at4$Type_TE, c(NA, NA, "57681")) + expect_equal(poi_out_at4$nexus, c(FALSE, FALSE, TRUE)) }) -- GitLab