Skip to content

Commit

Permalink
fix few more init_site() in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jayhesselberth committed Nov 29, 2023
1 parent 40dc4e2 commit 24ff4cc
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 55 deletions.
16 changes: 0 additions & 16 deletions tests/testthat/_snaps/build-articles.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,6 @@

# BS5 article laid out correctly with and without TOC

Code
init_site(pkg)
Message
Copying ../../../../inst/BS5/assets/link.svg and ../../../../inst/BS5/assets/pkgdown.js
to link.svg and pkgdown.js

---

Code
toc_true_path <- build_article("standard", pkg)
Message
Expand Down Expand Up @@ -123,14 +115,6 @@

# pkgdown deps are included only once in articles

Code
init_site(pkg)
Message
Copying ../../../../inst/BS5/assets/link.svg and ../../../../inst/BS5/assets/pkgdown.js
to link.svg and pkgdown.js

---

Code
path <- build_article("html-deps", pkg)
Message
Expand Down
8 changes: 0 additions & 8 deletions tests/testthat/_snaps/build-home-index.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
# version formatting in preserved

Code
init_site(pkg)
Message
Copying ../../../../inst/BS3/assets/bootstrap-toc.css, ../../../../inst/BS3/assets/bootstrap-toc.js, ../../../../inst/BS3/assets/docsearch.css, ../../../../inst/BS3/assets/docsearch.js, ../../../../inst/BS3/assets/link.svg, ../../../../inst/BS3/assets/pkgdown.css, and ../../../../inst/BS3/assets/pkgdown.js
to bootstrap-toc.css, bootstrap-toc.js, docsearch.css, docsearch.js, link.svg, pkgdown.css, and pkgdown.js

# data_home_sidebar() works by default

Code
Expand Down
16 changes: 0 additions & 16 deletions tests/testthat/_snaps/build-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,6 @@
Reading man/e.Rd
Writing reference/e.html

---

Code
init_site(pkg)
Message
Copying ../../../../inst/BS5/assets/link.svg and ../../../../inst/BS5/assets/pkgdown.js
to link.svg and pkgdown.js

---

Code
Expand All @@ -45,14 +37,6 @@

# pkgdown html dependencies are suppressed from examples in references

Code
init_site(pkg)
Message
Copying ../../../../inst/BS5/assets/link.svg and ../../../../inst/BS5/assets/pkgdown.js
to link.svg and pkgdown.js

---

Code
build_reference(pkg, topics = "a")
Message
Expand Down
10 changes: 0 additions & 10 deletions tests/testthat/_snaps/init.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
# single extra.css correctly copied

Code
init_site(pkg)
Message
Copying ../../../../inst/BS3/assets/bootstrap-toc.css, ../../../../inst/BS3/assets/bootstrap-toc.js, ../../../../inst/BS3/assets/docsearch.css, ../../../../inst/BS3/assets/docsearch.js, ../../../../inst/BS3/assets/link.svg, ../../../../inst/BS3/assets/pkgdown.css, and ../../../../inst/BS3/assets/pkgdown.js
to bootstrap-toc.css, bootstrap-toc.js, docsearch.css, docsearch.js, link.svg, pkgdown.css, and pkgdown.js
Copying pkgdown/extra.css
to extra.css

# site meta doesn't break unexpectedly

Code
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-build-articles.R
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ test_that("BS5 article laid out correctly with and without TOC", {
bootstrap: 5
")

expect_snapshot(init_site(pkg))
suppressMessages(expect_message(init_site(pkg)))
expect_snapshot(toc_true_path <- build_article("standard", pkg))
expect_snapshot(toc_false_path <- build_article("toc-false", pkg))

Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-build-home-index.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ test_that("version formatting in preserved", {
pkg <- local_pkgdown_site(test_path("assets/version-formatting"))
expect_equal(pkg$version, "1.0.0-9000")

expect_snapshot(init_site(pkg))
suppressMessages(expect_message(init_site(pkg)))
build_home_index(pkg, quiet = TRUE)
index <- read_lines(path(pkg$dst_path, "index.html"))
expect_true(any(grepl("1.0.0-9000", index, fixed = TRUE)))
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-build-reference.R
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ test_that(".Rd without usage doesn't get Usage section", {
template:
bootstrap: 5
")
expect_snapshot(init_site(pkg))
suppressMessages(expect_message(init_site(pkg)))
expect_snapshot(build_reference(pkg, topics = "e"))
html <- xml2::read_html(file.path(pkg$dst_path, "reference", "e.html"))
# tweak_anchors() moves id into <h2>
Expand All @@ -71,7 +71,7 @@ test_that(".Rd without usage doesn't get Usage section", {

test_that("pkgdown html dependencies are suppressed from examples in references", {
pkg <- local_pkgdown_site(test_path("assets/reference-html-dep"))
expect_snapshot(init_site(pkg))
suppressMessages(expect_message(init_site(pkg)))
expect_snapshot(build_reference(pkg, topics = "a"))
html <- xml2::read_html(file.path(pkg$dst_path, "reference", "a.html"))

Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-init.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ test_that("extra.css and extra.js copied and linked", {
test_that("single extra.css correctly copied", {
local_edition(3)
pkg <- local_pkgdown_site(test_path("assets/init-extra-1"))
expect_snapshot(init_site(pkg))
suppressMessages(expect_message(init_site(pkg)))

expect_true(file_exists(path(pkg$dst_path, "extra.css")))
})
Expand Down

0 comments on commit 24ff4cc

Please sign in to comment.