tests/testthat/test-download.R

context("download_package_plan")

test_that("can download a plan", {
  skip_on_cran()

  withr::local_options(list(repos = "https://cloud.r-project.org/"))

  lib <- tempfile()
  on.exit(unlink(lib, recursive = TRUE), add = TRUE)
  rem <- pkgdepends::remotes()$new("processx", library = lib)
  rem$solve()
  plan <- rem$get_install_plan(FALSE)

  plan2 <- download_package_plan(plan, quiet = TRUE)

  expect_true("file" %in% colnames(plan2))
  expect_true("download_dir" %in% colnames(plan2))
  expect_equal(length(unique(plan2$download_dir)), 1)
  expect_true(all(file.exists(plan2$file)))
})
gaborcsardi/installlite documentation built on May 22, 2019, 5:33 p.m.