Skip to content

Commit

Permalink
Update pval-hist tests
Browse files Browse the repository at this point in the history
  • Loading branch information
milanmlft committed Nov 19, 2020
1 parent 2f91b14 commit 9536281
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 4 deletions.
2 changes: 1 addition & 1 deletion tests/figs/deps.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
- vdiffr-svg-engine: 1.0
- vdiffr: 0.3.2
- vdiffr: 0.3.3
- freetypeharfbuzz: 0.2.5
81 changes: 81 additions & 0 deletions tests/figs/geom-pval-hist.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 10 additions & 2 deletions tests/testthat/test-plots.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,16 @@ test_that("Output of gg_pval_hist() is stable", {
# Create synthetic p-values, includes the value 0, so first bin [0, 0.05] will
# contain 6 values, while all others will contain 5
pvals <- seq(0, 1, by = 0.01)
vdiffr::expect_doppelganger("p-value histogram", gg_pval_hist(pvals),
path = "")
vdiffr::expect_doppelganger("gg_pval_hist", gg_pval_hist(pvals), path = "")
})

test_that("Output of geom_pval_hist() is stable", {
df <- data.frame(pval = seq(0, 1, by = 0.01))
p <- ggplot2::ggplot(df, aes(pval)) +
geom_pval_hist(fill = "grey65", col = "black") +
scale_x_continuous(breaks = seq(0, 1, by = 0.1)) +
scale_y_continuous(expand = expansion(mult = c(0, 0.05)))
vdiffr::expect_doppelganger("geom_pval_hist", p, path = "")
})

test_that("save_plots() creates PDF", {
Expand Down

0 comments on commit 9536281

Please sign in to comment.