Skip to main content

test_context

Function test_context 

Source
pub fn test_context() -> RequestContext
Expand description

A deterministic RequestContext with a seeded request id and a pinned received_at.

Equivalent to TestContextBuilder::new().build(). Use the builder when you need to set tenant, locale, or other fields.

use klauthed_testing::context::test_context;

let a = test_context();
let b = test_context();
// Reproducible: same request id and arrival time every time.
assert_eq!(a.request_id(), b.request_id());
assert_eq!(a.received_at(), b.received_at());