tests/testthat/test-make_notebooks.R

test_that("creating simple analysis + makefile does not error", {
  analysis_1 <- new_analysis(name = "test_analysis_1")
  suppressMessages(analysis_1 %<>% add_notebook("test_notebook_1.Rmd", products = c("result_1" = "test_dep_file.txt")))
  suppressMessages(analysis_1 %<>% add_notebook("test_notebook_2.Rmd", dependencies = c("example_dep_1" = "result_1")))
  analysis_1 %>% write_makefile()
  expect_true(TRUE)
  make_output <- system2("make", stdout = TRUE)
  Sys.sleep(1)
  expect_equal(attr(make_output, "status"), NULL)
  expect_equal(system2("make", stdout = TRUE), "make: Nothing to be done for 'test_analysis_1'.")
  fs::file_delete("makefile")
  fs::file_delete("test_analysis_1.mk")
  fs::dir_delete("results")
  fs::dir_delete("results_human")
})
jan-glx/analysismaker documentation built on March 29, 2025, 11:58 a.m.