tests/testthat/test-template_create.R

authors <- c("Josep Maria", "Jane Doe")

test_that("template_create returns data.frame", {
  expect_s3_class(template_create(authors = authors), "data.frame")
})

test_that("create_template does not return anything if file is provided",{
  expect_invisible(template_create(authors, file = tempfile()))
})

test_that("roles passed overwrite the default", {
  custom_roles <- sample(LETTERS, 4)
  template <- template_create(authors, roles = custom_roles)
  expect_equal(names(template), c("Authors", custom_roles))
})

Try the CRediTas package in your browser

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

CRediTas documentation built on April 14, 2023, 12:30 a.m.