tests/testthat/test_figures_summary_plot.R

data("data_fungi")
data("data_fungi_sp_known")
data("GlobalPatterns", package = "phyloseq")
data("enterotype", package = "phyloseq")

GP <- GlobalPatterns

test_that("summary_plot_pq works with data_fungi dataset", {
  skip_on_cran()
  expect_s3_class(summary_plot_pq(data_fungi), "ggplot")
  expect_silent(summary_plot_pq(data_fungi, add_info = FALSE))
  expect_silent(summary_plot_pq(
    data_fungi,
    add_info = FALSE,
    min_seq_samples = 33
  ))
  expect_message(summary_plot_pq(data_fungi) + scale_fill_viridis_d())
  expect_silent(summary_plot_pq(data_fungi, clean_pq = FALSE))
})

test_that("summary_plot_pq separates the min-depth sample name from its count", {
  p <- summary_plot_pq(data_fungi_mini)
  info <- p$layers[[length(p$layers)]]$data$nb_values
  expect_match(info, "Min nb seq per sample \\([^)]+\\): [0-9]+\n")
})

test_that("summary_plot_pq works with GP dataset", {
  expect_message(summary_plot_pq(GP))
  skip_on_cran()
  expect_s3_class(summary_plot_pq(GP), "ggplot")
  expect_message(summary_plot_pq(GP, add_info = FALSE))
  expect_message(summary_plot_pq(GP, add_info = FALSE, min_seq_samples = 33))
  expect_message(summary_plot_pq(GP) + scale_fill_viridis_d())
  expect_silent(summary_plot_pq(GP, clean_pq = FALSE))
})

test_that("summary_plot_pq works with enterotype dataset", {
  skip_on_cran()
  expect_s3_class(summary_plot_pq(enterotype), "ggplot")
  expect_silent(summary_plot_pq(enterotype, add_info = FALSE))
  expect_silent(summary_plot_pq(
    enterotype,
    add_info = FALSE,
    min_seq_samples = 33
  ))
  expect_message(summary_plot_pq(enterotype) + scale_fill_viridis_d())
  expect_silent(summary_plot_pq(enterotype, clean_pq = FALSE))
})

Try the MiscMetabar package in your browser

Any scripts or data that you put into this service are public.

MiscMetabar documentation built on Nov. 16, 2026, 5:06 p.m.