tests/testthat/test_skeleton.R

test_that(
  "Knit bare skeleton"
  , {
    skip_on_cran()

    # Render skeleton
    bare_path <- file.path(tempdir(), "bare_skeleton.Rmd")

    rmarkdown::draft(
      bare_path
      , system.file(
        "rmarkdown", "templates", "apa6"
        , package = "papaja"
      )
      , create_dir = FALSE
      , edit = FALSE
    )

    try(
      rmarkdown::render(
        bare_path
        , output_format = "papaja::apa6_pdf"
        , quiet = TRUE
      )
    )
    expect_true(file.exists(gsub("\\.Rmd", ".pdf", bare_path)))

    try(
      rmarkdown::render(
        file.path(tempdir(), "bare_skeleton.Rmd")
        , output_format = "papaja::apa6_docx"
        , quiet = TRUE
      )
    )
    expect_true(file.exists(gsub("\\.Rmd", ".docx", bare_path)))
  }
)

Try the papaja package in your browser

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

papaja documentation built on Oct. 30, 2024, 9:09 a.m.