diff --git a/apps/web/src/schemas/__tests__/validation.property.test.ts b/apps/web/src/schemas/__tests__/validation.property.test.ts index 06cef929d..44cc99a56 100644 --- a/apps/web/src/schemas/__tests__/validation.property.test.ts +++ b/apps/web/src/schemas/__tests__/validation.property.test.ts @@ -68,10 +68,24 @@ function safeChatContent(min: number, max: number) { /** Arbitrary that generates valid UUIDs */ const validUuid = fc.uuid(); -/** Arbitrary that generates valid ISO 8601 datetime strings */ -const validIsoDate = fc.date({ min: new Date('2000-01-01'), max: new Date('2099-12-31') }).map( - (d) => d.toISOString(), -); +/** + * Arbitrary that generates valid ISO 8601 datetime strings. + * + * `noInvalidDate: true` excludes the `new Date(NaN)` "Invalid Date" + * sentinel that fast-check's `fc.date()` would otherwise produce + * occasionally. Without it, a sporadic CI run hits + * RangeError: Invalid time value + * inside `.toISOString()` and fails the whole property suite — a + * non-deterministic flake that has nothing to do with the property + * being asserted. + */ +const validIsoDate = fc + .date({ + min: new Date('2000-01-01'), + max: new Date('2099-12-31'), + noInvalidDate: true, + }) + .map((d) => d.toISOString()); /** Arbitrary that generates valid email-shaped strings */ const validEmail = fc