Stitch any CI into Tangled
1package jetstream
2
3import (
4 "testing"
5 "time"
6)
7
8func TestConsumerRewindCursor(t *testing.T) {
9 c := &Consumer{rewind: 5 * time.Second}
10
11 cursor := int64(10_000_000)
12 rewound := c.rewindCursor(&cursor)
13 if rewound == nil || *rewound != 5_000_000 {
14 t.Fatalf("rewound = %v, want 5000000", rewound)
15 }
16
17 cursor = 2_000_000
18 rewound = c.rewindCursor(&cursor)
19 if rewound == nil || *rewound != 0 {
20 t.Fatalf("rewound = %v, want 0", rewound)
21 }
22}