tests/testthat/test-create_n_mb_species_file.R

test_that("use", {

  # Should create 'results/'marg_liks.csv'
  filename <- create_n_mb_species_file(
    project_folder_name = raztr::get_raztr_path("razzo_project")
  )

  # File should be created
  expect_true(file.exists(filename))

  # OK: filename is '[something]/razzo_project/results/n_mb_species.csv'
  expect_true(
    length(
      grep(
        pattern = "razzo_project.results.n_mb_species\\.csv$",
        filename, perl = TRUE, value = TRUE
      )
    ) > 0
  )

  # Clean up
  file.remove(filename)
})

test_that("abuse", {
  expect_error(
    create_n_mb_species_file(project_folder_name = "nonsense"),
    "'project_folder_name' must end with 'razzo_project'"
  )
})
richelbilderbeek/razzo documentation built on March 10, 2021, 1:17 p.m.