swh:1:snp:bdc19e867479541d0f4994ceaa711217d0dc28ed
Tip revision: 1ad2332a4119217014f512bdf05025fa6f2bb72f authored by Hadley Wickham on 09 April 2020, 13:00:02 UTC
version 1.5.1
version 1.5.1
Tip revision: 1ad2332
test-build-home-index.R
context("test-build-home-index")
# repo_link ------------------------------------------------------------
test_that("package repo verification", {
skip_on_cran() # requires internet connection
expect_null(cran_link("notarealpkg"))
expect_equal(
cran_link("dplyr"),
list(
repo = "CRAN",
url = "https://cloud.r-project.org/package=dplyr"
)
)
expect_equal(
cran_link("Biobase"),
list(
repo = "BIOC",
url = "https://www.bioconductor.org/packages/Biobase"
)
)
})
test_that("homepage title defaults to package Title", {
pkg <- test_path("assets/home-index-rmd")
expect_equal(
as.character(data_home(pkg))[[1]],
"A test package"
)
})
test_that("homepage title can be overridden", {
pkg <- test_path("assets/home-index-rmd")
pkg <- as_pkgdown(pkg)
pkg$meta <- list(home = list(
title = "Such a cool package"))
expect_equal(
as.character(data_home(pkg))[[1]],
"Such a cool package"
)
})
test_that("homepage description defaults to package Description", {
pkg <- test_path("assets/home-index-rmd")
expect_true(
grepl("A test package",
as.character(data_home(pkg))[[3]],
)
)
})
test_that("homepage description can be overridden", {
pkg <- test_path("assets/home-index-rmd")
pkg <- as_pkgdown(pkg)
pkg$meta <- list(home = list(
description = "A free description."))
expect_true(
grepl("A free description.",
as.character(data_home(pkg))[[3]],
)
)
})