Skip to content

Commit 6d322b6

Browse files
12wrigjaptomato
andauthored
Update manual ISO string tests to account for disallowed Z (#101)
Co-authored-by: Philip Chimento <[email protected]>
1 parent 47f9132 commit 6d322b6

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

test/validStrings.mjs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,12 +384,16 @@ const comparisonItems = {
384384
YearMonth: ['year', 'month'],
385385
ZonedDateTime: [...dateItems, ...timeItems, 'offset', 'ianaName', 'calendar']
386386
};
387+
const plainModes = ['Date', 'DateTime', 'MonthDay', 'Time', 'YearMonth'];
387388

388389
const mode = 'Instant';
389390

390391
for (let count = 0; count < 1000; count++) {
391-
const generatedData = {};
392-
const fuzzed = goals[mode].generate(generatedData);
392+
let generatedData, fuzzed;
393+
do {
394+
generatedData = {};
395+
fuzzed = goals[mode].generate(generatedData);
396+
} while (plainModes.includes(mode) && /[0-9][zZ]/.test(fuzzed));
393397
try {
394398
const parsed = ES[`ParseTemporal${mode}String`](fuzzed);
395399
for (let prop of comparisonItems[mode]) {

0 commit comments

Comments
 (0)