MCPcopy
hub / github.com/docker/docker-agent / TestNew_UsesInjectedClockAndID

Function TestNew_UsesInjectedClockAndID

pkg/session/clock_test.go:32–47  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

30}
31
32func TestNew_UsesInjectedClockAndID(t *testing.T) {
33 t.Parallel()
34 fixed := time.Date(2024, 1, 2, 3, 4, 5, 0, time.UTC)
35
36 s := New(WithClock(fixedClock(fixed)), WithIDGen(stubIDs(t, "test-session-1")))
37
38 if s.ID != "test-session-1" {
39 t.Errorf("ID = %q, want %q", s.ID, "test-session-1")
40 }
41 if !s.CreatedAt.Equal(fixed) {
42 t.Errorf("CreatedAt = %v, want %v", s.CreatedAt, fixed)
43 }
44 if !s.SendUserMessage {
45 t.Error("SendUserMessage should default to true")
46 }
47}
48
49func TestNew_WithIDOverridesGenerator(t *testing.T) {
50 t.Parallel()

Callers

nothing calls this directly

Calls 6

fixedClockFunction · 0.85
WithIDGenFunction · 0.85
stubIDsFunction · 0.85
NewFunction · 0.70
WithClockFunction · 0.70
ErrorMethod · 0.45

Tested by

no test coverage detected