1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//! Test utilities for klauthed services.
//!
//! A small, focused toolkit that services pull in as a **dev-dependency** to make
//! unit and integration tests deterministic and terse. It builds directly on the
//! `klauthed-core` primitives, so test fixtures use the same types as production
//! code.
//!
//! * [`clock`] — a [`FixedClock`] you can pin and advance, plus re-exports of
//! [`Clock`] / [`Timestamp`].
//! * [`ids`] — deterministic [`Id<T>`](klauthed_core::id::Id) fixtures from a `u64`
//! seed ([`seeded_id`], [`nil_id`]).
//! * [`context`] — a deterministic
//! [`RequestContext`](klauthed_core::context::RequestContext) builder
//! ([`test_context`], [`TestContextBuilder`]).
//! * [`repository`] — a thread-safe in-memory
//! [`Repository`](klauthed_core::domain::Repository) ([`InMemoryRepository`]).
//! * [`assertions`] — terse [`DomainError`](klauthed_error::DomainError) assertions
//! ([`assert_category`], [`assert_code`], and the [`DomainErrorExt`] trait).
//!
//! The most-used items are re-exported at the crate root for convenience.
//!
//! Out of scope for this first cut (possible future work): mock HTTP servers,
//! testcontainers / database harnesses, and clock-driven async test runners.
//!
//! ```
//! use klauthed_testing::{fixed_clock, seeded_id, test_context, Clock};
//! use klauthed_core::id::Id;
//!
//! struct User;
//!
//! let clock = fixed_clock(1_700_000_000_000);
//! let user_id: Id<User> = seeded_id(7);
//! let ctx = test_context();
//!
//! assert_eq!(clock.now().unix_millis(), 1_700_000_000_000);
//! assert_eq!(user_id, seeded_id::<User>(7));
//! assert_eq!(ctx.request_id(), test_context().request_id());
//! ```
pub use ;
pub use ;
pub use ;
pub use TestingError;
pub use ;
pub use InMemoryRepository;