(t *testing.T)
| 24 | func (c *fakeClock) Advance(d time.Duration) { c.t = c.t.Add(d) } |
| 25 | |
| 26 | func TestWithClock_AppliedToRuntime(t *testing.T) { |
| 27 | t.Parallel() |
| 28 | |
| 29 | prov := &mockProvider{id: "test/mock-model"} |
| 30 | root := agent.New("root", "test", agent.WithModel(prov)) |
| 31 | tm := team.New(team.WithAgents(root)) |
| 32 | |
| 33 | fixed := time.Date(2024, 1, 2, 3, 4, 5, 0, time.UTC) |
| 34 | clock := newFakeClock(fixed) |
| 35 | |
| 36 | rt, err := NewLocalRuntime(t.Context(), tm, |
| 37 | WithClock(clock.Now), |
| 38 | WithModelStore(mockModelStore{}), |
| 39 | ) |
| 40 | require.NoError(t, err) |
| 41 | |
| 42 | assert.Equal(t, fixed, rt.now(), "WithClock not wired into runtime") |
| 43 | } |
| 44 | |
| 45 | func TestWithClock_NilLeavesDefault(t *testing.T) { |
| 46 | t.Parallel() |
nothing calls this directly
no test coverage detected