diff --git a/tests/testthat/test-plot.GRiwrm.R b/tests/testthat/test-plot.GRiwrm.R index 0622d3924d0c817d84b106015e9195a59cf9c4c6..24d4abe2cc82af3f86a420ac9ad420808ea9be42 100644 --- a/tests/testthat/test-plot.GRiwrm.R +++ b/tests/testthat/test-plot.GRiwrm.R @@ -11,7 +11,7 @@ test_that("Diverted ungauged nodes have correct color", { expect_true(any(grepl("id_54029 UpstreamUngaugedDiversion", strsplit(mmd, "\n\n")[[1]]))) }) -test_that("Unguaged nodes and donors are in a box!", { +test_that("Ungauged nodes and donors are in a box!", { nds <- loadSevernNodes() nds$donor <- as.character(NA) nds$model[nds$id %in% c("54001", "54032", "54029")] <- "Ungauged" @@ -23,3 +23,10 @@ test_that("Unguaged nodes and donors are in a box!", { s <- plot(g, display = FALSE) expect_equal(strsplit(s, "\n")[[1]][c(5,13)], c("subgraph donor_54095 [54095]", "end")) }) + +test_that("Single node plot does not crash", { + sgl_node <- loadSevernNodes()[1,] + g <- CreateGRiwrm(sgl_node) + mmd <- plot(g, display = FALSE) + expectfalse(grepl("-->", mmd, fixed = TRUE)) +})