smos_application/testkit/clock.rs
1//! Clock and delay test doubles.
2//!
3//! `FixedClock` always reports the same instant — used by every use-case unit
4//! test so timestamps are deterministic. `NoOpDelay` collapses retry backoff to
5//! zero so the suite never pays the real sleeps; timing is still verified
6//! end-to-end against the real `TokioDelay` adapter.
7
8use std::time::Duration;
9
10use smos_domain::Timestamp;
11
12use crate::ports::{Clock, Delay};
13
14#[derive(Clone)]
15pub struct FixedClock(pub Timestamp);
16
17impl Clock for FixedClock {
18 fn now(&self) -> Timestamp {
19 self.0
20 }
21}
22
23#[derive(Clone, Copy)]
24pub struct NoOpDelay;
25
26impl Delay for NoOpDelay {
27 async fn delay(&self, _duration: Duration) {}
28}