Skip to content

Commit dbb35bb

Browse files
committed
tests that test our internal logic/assumptions are not tests
1 parent 4e3af9c commit dbb35bb

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

tests/testthat/test-ggplot-density.R

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,9 @@ test_that("geom_density() respects fill aesthetic", {
3333
expect_identical(type, "scatter")
3434
expect_identical(fill, "tozeroy")
3535
# check legend exists
36-
expect_identical(la$showlegend, TRUE)
36+
expect_true(info$layout$showlegend, TRUE)
3737
# check legend for each fill exists
38-
for (i in 1:2) {
39-
expect_identical(trs[[i]]$showlegend, TRUE)
40-
}
41-
# check the fill colors are correct
42-
g <- ggplot_build(gg)
43-
fill.colors <- unique(g$data[[1]]["fill"])[,1]
44-
for (i in 1:2) {
45-
plotly.color <- as.integer(
46-
strsplit(gsub("[\\(\\)]|rgba", "",
47-
trs[[i]]$fillcolor), split = ",")[[1]])[1:3]
48-
names(plotly.color) <- c("red", "green", "blue")
49-
expect_equal(plotly.color, col2rgb(fill.colors[i])[,1],
50-
tolerance = 1)
51-
}
38+
expect_true(all(sapply(trs, "[[", "showlegend")))
5239
})
5340

5441
test_that("geom_density() respects colour aesthetic", {

0 commit comments

Comments
 (0)