Skip to content

Commit 3c5ac70

Browse files
committed
fix(test): reduce flakiness in TTL boundary test
Change timestamp from `now - 999` to `now - 900` to provide a 100ms buffer for test execution time. The test was flaky because between creating the timestamp and checking isFresh(), enough time could pass to make the record exactly at or past the 1000ms TTL boundary. This fixes intermittent failures where the test expected true but got false due to timing issues.
1 parent 413a8c6 commit 3c5ac70

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/cli/test/unit/utils/update/store.test.mts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,9 +255,9 @@ describe('store', () => {
255255

256256
it('should handle edge case at TTL boundary', () => {
257257
const now = Date.now()
258-
// Just under 1 second
258+
// Well under 1 second with buffer for test execution time.
259259
const record: StoreRecord = {
260-
timestampFetch: now - 999,
260+
timestampFetch: now - 900,
261261
timestampNotification: 0,
262262
version: '1.0.0',
263263
}

0 commit comments

Comments
 (0)