Skip to main content

set_config

Function set_config 

Source
pub fn set_config<T: ConfigType>(
    config: &impl AnyConfig<T>,
    value: Value,
) -> Result<(), Error>
Expand description

Gives config a value for the current test, in place of the app’s. No other test sees it, and it is gone when the test ends. The value is checked against the config’s schema, and read as its type, here.

ⓘ
encore::testing::set_config(&CHECKOUT, serde_json::json!({"max_items": 2}))?;
assert_eq!(CHECKOUT.get().max_items, 2);