tests/testthat/test-build_site.R

test_that("build_site generates an html file", {
  out_file <- tempfile()

  build_site(
    path = system.file(
      file.path("examples", "annual-escapement.json"),
      package = "dataspice"
    ),
    out_path = out_file
  )

  expect_true(file.exists(out_file))
  expect_equal(readLines(out_file)[1], "<html>")
})

test_that("build_site creates a docs dir if needed", {
  out_dir <- tempdir()
  old_wd <- getwd()
  on.exit(setwd(old_wd))
  setwd(out_dir)

  build_site(
    path = system.file(
      file.path("examples", "annual-escapement.json"),
      package = "dataspice"
    )
  )

  expect_true(dir.exists("docs"))
})

Try the dataspice package in your browser

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

dataspice documentation built on May 17, 2021, 1:09 a.m.