tests/testthat/test-pre_inflate_all_diagnosis_eval.R

# WARNING - Generated by {fusen} from dev/flat_inflate_all_utils.Rmd: do not edit by hand

test_that("pre_inflate_all_diagnosis_eval works", {
  expect_true(inherits(pre_inflate_all_diagnosis_eval, "function"))

  diagnostic <- structure(
    list(
      flat = c(
        "flat_minimal.Rmd", "flat_minimal_2.Rmd",
        "missing_file.Rmd"
      ),
      status = structure(
        c(
          "The flat file flat_minimal.Rmd is going to be inflated",
          "The flat file flat_minimal2.Rmd is not going to be inflated because it is 'inactive or deprecated'",
          "The file missing_file.Rmd is not going to be inflated because it was not found, have you changed the name or did you move in another place ? Maybe you want to set the state as 'deprecated' in the config file"
        ),
        class = c("glue", "character")
      ),
      type = c(
        "cli::cli_alert_success", "cli::cli_alert_warning",
        "stop"
      ),
      params = c(NA, NA, "call. = FALSE")
    ),
    row.names = c(NA, -3L),
    class = c(
      "tbl_df", "tbl",
      "data.frame"
    )
  )

  expect_error(
    pre_inflate_all_diagnosis_eval(diagnostic, type_stop = TRUE),
    regexp = "The file missing_file[.]Rmd is not going to be inflated"
  )

  expect_message(
    pre_inflate_all_diagnosis_eval(diagnostic, type_stop = FALSE),
    regexp = "The flat file flat_minimal[.]Rmd is going to be inflated"
  )

  expect_message(
    pre_inflate_all_diagnosis_eval(diagnostic, type_stop = FALSE),
    regexp = "The flat file flat_minimal2[.]Rmd is not going to be inflated"
  )
})

Try the fusen package in your browser

Any scripts or data that you put into this service are public.

fusen documentation built on Aug. 17, 2023, 5:09 p.m.