Skip to content

Commit

Permalink
fixup! errors: fix ERR_UNSUPPORTED_ESM_URL_SCHEME error message
Browse files Browse the repository at this point in the history
Signed-off-by: Daeyeon Jeong <[email protected]>
Co-authored-by: Antoine du Hamel <[email protected]>
  • Loading branch information
daeyeon and aduh95 committed Dec 9, 2022
1 parent 657e660 commit 9a04ac1
Showing 1 changed file with 12 additions and 22 deletions.
34 changes: 12 additions & 22 deletions test/parallel/test-error-format-list.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,18 @@
// Flags: --expose-internals
'use strict';

require('../common');
const common = require('../common');
const { strictEqual } = require('node:assert');
const { formatList } = require('internal/errors');

strictEqual(formatList([]), '');

strictEqual(formatList([], 'or'), '');

strictEqual(formatList(['apple']), 'apple');

strictEqual(formatList(['apple'], 'or'), 'apple');

strictEqual(formatList(['apple', 'banana']), 'apple and banana');

strictEqual(formatList(['apple', 'banana'], 'or'), 'apple or banana');

strictEqual(
formatList(['apple', 'banana', 'orange']),
'apple, banana, and orange'
);

strictEqual(
formatList(['apple', 'banana', 'orange'], 'or'),
'apple, banana, or orange'
);
if (common.hasIntl) {
const and = new Intl.ListFormat('en', { style: 'long', type: 'conjunction' });
const or = new Intl.ListFormat('en', { style: 'long', type: 'disjunction' });

const input = ['apple', 'banana', 'orange'];
for (let i = 0; i < input.length; i++) {
const slicedInput = input.slice(0, i);
strictEqual(formatList(slicedInput), and.format(slicedInput));
strictEqual(formatList(slicedInput, 'or'), or.format(slicedInput));
}
}

0 comments on commit 9a04ac1

Please sign in to comment.