diff --git a/tests/testthat/_snaps/graph.md b/tests/testthat/_snaps/graph.md index 07f546eb40..4d9d52adba 100644 --- a/tests/testthat/_snaps/graph.md +++ b/tests/testthat/_snaps/graph.md @@ -5,3 +5,18 @@ Output [1] "airlines|flights" "airports|flights" "flights|planes" "flights|weather" +# empty graph + + Code + create_graph_from_dm(empty_dm()) + Output + IGRAPH 1c33ea7 UN-- 0 0 -- + + attr: name (v/c) + + edges from 1c33ea7 (vertex names): + Code + create_graph_from_dm(dm(x = tibble(a = 1))) + Output + IGRAPH 2b92189 UN-- 1 0 -- + + attr: name (v/c) + + edges from 2b92189 (vertex names): + diff --git a/tests/testthat/test-graph.R b/tests/testthat/test-graph.R index f56c7279d7..866fe6aecb 100644 --- a/tests/testthat/test-graph.R +++ b/tests/testthat/test-graph.R @@ -30,3 +30,10 @@ test_that("functions working with graphs do the right thing?", { attr(igraph::E(create_graph_from_dm(nyc_comp())), "vnames") }) }) + +test_that("empty graph", { + expect_snapshot({ + create_graph_from_dm(empty_dm()) + create_graph_from_dm(dm(x = tibble(a = 1))) + }) +})