tests/testthat/test-gather_spectra_stats.R

# WARNING - Generated by {fusen} from dev/flat_utils.Rmd: do not edit by hand

test_that("gather_spectra_stats works", {
  expect_equal(check_spectra(
    c(MALDIquant::createMassSpectrum(1:3, 1:3), MALDIquant::createMassSpectrum(11:13, 11:13))
  ) |> gather_spectra_stats(), structure(list(
    n_spectra = 2L, n_valid_spectra = 2L, is_empty = 0L,
    is_outlier_length = 0L, is_not_regular = 0L
  ), class = c(
    "tbl_df",
    "tbl", "data.frame"
  ), row.names = c(NA, -1L)))
})
test_that("gather_spectra_stats fails",{
  expect_error(
    gather_spectra_stats("spectra"),
    "check_vectors is not a named list"
  )
  expect_error(
    gather_spectra_stats(list("foo" = c(TRUE,TRUE),"bar" = c(TRUE))),
    "Unexpected format for checks_vectors. Are you sure this is the output of maldipickr::check_spectra()?"
  )
})

Try the maldipickr package in your browser

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

maldipickr documentation built on Sept. 13, 2024, 1:12 a.m.