Skip to content

Commit 3d2ce1c

Browse files
committed
add happy path test for ParseTimeWindow with valid start and end
1 parent 82516ab commit 3d2ce1c

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

internal/infra/mcp/tools/utils_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,17 @@ var _ = Describe("ParseTimeWindow", func() {
9090
Expect(err).To(MatchError(ContainSubstring("must be after start")))
9191
})
9292

93+
It("returns correct TimeWindow when both start and end are valid past timestamps", func() {
94+
mockClock.EXPECT().Now().Return(now)
95+
tw, err := tools.ParseTimeWindow(makeRequest(map[string]any{
96+
"start": "2026-04-16T10:00:00Z",
97+
"end": "2026-04-16T11:00:00Z",
98+
}), mockClock)
99+
Expect(err).NotTo(HaveOccurred())
100+
Expect(tw.Start).To(Equal(time.Date(2026, time.April, 16, 10, 0, 0, 0, time.UTC)))
101+
Expect(tw.End).To(Equal(time.Date(2026, time.April, 16, 11, 0, 0, 0, time.UTC)))
102+
})
103+
93104
It("truncates sub-second precision from now so RangeSelector never emits [0s]", func() {
94105
// now has 500ms; start is in the same second — after truncation end == start,
95106
// which must be rejected rather than silently producing [0s].

0 commit comments

Comments
 (0)