tests/testthat/test-install.R

context("install_package_plan")

test_that("can install 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("R6", library = lib)
  rem$solve()
  plan <- rem$get_install_plan(FALSE)

  plan2 <- install_package_plan(plan, lib = lib, 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)))

  pkgs <- plan$package
  for (pkg in pkgs) expect_true(pkg %in% dir(lib), info = pkg)
})
gaborcsardi/installlite documentation built on May 22, 2019, 5:33 p.m.