Skip to content

Commit

Permalink
Merge pull request #131 from MichaelChirico/sugg-alluvial
Browse files Browse the repository at this point in the history
Optionally skip tests when Suggests dep 'alluvial' is not installed
  • Loading branch information
corybrunson authored Aug 10, 2024
2 parents 5b42a51 + 58bbdc4 commit ecf582c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/testthat/test-geom-alluvium.r
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
# visual tests

test_that("`geom_alluvium` draws correctly", {
skip_on_cran()
skip_if_not_installed("vdiffr")
skip_if_not_installed("alluvial")

d1 <- as.data.frame(Titanic)
a1 <- aes(y = Freq, axis1 = Class, axis2 = Sex, axis3 = Age, fill = Survived)
a2 <- aes(y = Freq, axis1 = Class, axis2 = Sex)
d2 <- alluvial::Refugees
a3 <- aes(y = refugees, x = year, alluvium = country)

skip_on_cran()
skip_if_not_installed("vdiffr")
vdiffr::expect_doppelganger(
"`geom_alluvium`: basic",
ggplot(d1, a1) + geom_alluvium()
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-stat-alluvium.r
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ test_that("`stat_alluvium` orders alluvia correctly according to `aes.bind`", {
# exceptional data

test_that("`stat_flow` handles exceptional data with out errors", {
skip_if_not_installed("alluvial")
data(Refugees, package = "alluvial")
refugees_sub <- subset(Refugees, year %in% c(2003, 2005, 2010, 2013))
gg <- ggplot(refugees_sub, aes(x = year, y = refugees, alluvium = country)) +
Expand Down

0 comments on commit ecf582c

Please sign in to comment.