context("test: error_heatmap_plot")
test_that("Testing error heatmap plotting function", {
# Download required test files------------------------------------------------
BU_Match <- readRDS(system.file("testdata", "BU_Match.RDS", package = "pspecterlib"))
# Test error heatmap plot input checks----------------------------------------
# Matched peaks must be of the correct class
expect_error(
error_heatmap_plot(data.frame(test = 1)),
"MatchedPeaks is not an object of the matched_peaks class generated by get_matched_peaks"
)
# Include Isotopes must be a true or false
expect_error(
error_heatmap_plot(BU_Match, IncludeIsotopes = NA),
"IncludeIsotopes needs to be a single logical: a TRUE or FALSE."
)
# Interactive must be a true or false
expect_error(
error_heatmap_plot(BU_Match, Interactive = "FALSE"),
"Interactive needs to be a single logical: a TRUE or FALSE."
)
# Create an error heatmap plot------------------------------------------------
# Make a static plot without isotopes
HM1 <- error_heatmap_plot(BU_Match, IncludeIsotopes = FALSE, Interactive = FALSE)
expect_true(inherits(HM1, "ggplot"))
# Make a dynamic plot with isotopes
HM2 <- error_heatmap_plot(BU_Match, IncludeIsotopes = TRUE, Interactive = TRUE)
expect_true(inherits(HM2, "plotly"))
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.