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

library(dplyr)
library(purrr)
test_that("final_dose_calculation works", {
  scenario_test <- create_scenario(system.file("input_1culture_2pop.xlsx", package = "ambre"))

scenario_conc <- inflow_concentration(scenario = scenario_test,
 pathogenName = c("Campylobacter jejuni", "Escherichia coli"))

scenario_volume <-
  scenario_conc |>                     
  mutate(
    volume = map(
      .x = config,                                         
      .f = ~ simulate_exposure(config = .x)              
    )
  )

scenario_dose_ini <- initial_dose_calculation(scenario_volume)

scenario_scheme <- update_treatment_scheme(scenario_dose_ini)

scenario_with_logreduc_and_co <- scenario_scheme |> 
  mutate( log_reduction = map(config, simulate_treatment))

  result <- final_dose_calculation(scenario_with_logreduc_and_co)
  
  expect_true("final_dose" %in% names(result)
  ) 
})
