tests/testthat/test-hugo.R

test_that("can extract basic config options", {
  skip_if_no_hugo()

  config <- hugo_config(test_path("minimal/"))
  expect_type(config, "list")

  expect_equal(hugo_config_bool(config, "builddrafts"), FALSE)
  expect_equal(hugo_config_int(config, "paginate"), 10)
  expect_equal(hugo_config_str(config, "themesdir"), "themes")
})

test_that("can override config with env var", {
  skip_if_no_hugo()

  config1 <- hugo_config(test_path("minimal/"))
  expect_equal(hugo_config_bool(config1, "builddrafts"), FALSE)

  config2 <- hugo_config(test_path("minimal/"), c(builddrafts = "true"))
  expect_equal(hugo_config_bool(config2, "builddrafts"), TRUE)
})
r-lib/hugodown documentation built on Nov. 24, 2022, 10:06 a.m.