Skip to content

Commit 1919a1b

Browse files
committed
fixup! lib: refactor internal webidl converters
1 parent 18482ca commit 1919a1b

3 files changed

Lines changed: 5 additions & 4 deletions

File tree

lib/internal/webidl.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ function createEnumConverter(name, values) {
612612
// Step 2: throw unless S is one of the enumeration values.
613613
if (!E.has(S)) {
614614
throw makeException(
615-
`value '${S}' is not a valid enum value of type ${name}.`,
615+
`'${S}' is not a valid enum value of type ${name}.`,
616616
{ __proto__: null, ...options, code: 'ERR_INVALID_ARG_VALUE' });
617617
}
618618

test/parallel/test-internal-webidl.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ for (const value of [
244244
assert.throws(() => converter('three', opts), {
245245
name: 'TypeError',
246246
code: 'ERR_INVALID_ARG_VALUE',
247-
message: "Prefix: Context value 'three' is not a valid enum value " +
247+
message: "Prefix: Context 'three' is not a valid enum value " +
248248
'of type Example.',
249249
});
250250
}
@@ -512,6 +512,7 @@ assert.throws(() => webidl.requiredArguments(1, 2, opts), {
512512
__proto__: null,
513513
allowShared: true,
514514
};
515+
assertInvalidArgType(() => converters.BufferSource(sab, allowShared));
515516
assert.strictEqual(converters.BufferSource(view, allowShared), view);
516517
assert.strictEqual(converters.Uint8Array(view, allowShared), view);
517518

test/parallel/test-webcrypto-webidl.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ function assertJsonWebKey(actual, expected) {
311311
assert.throws(() => converters.KeyFormat(bad, opts), {
312312
name: 'TypeError',
313313
code: 'ERR_INVALID_ARG_VALUE',
314-
message: `${prefix}: ${context} value '${bad}' is not a valid enum value of type KeyFormat.`,
314+
message: `${prefix}: ${context} '${bad}' is not a valid enum value of type KeyFormat.`,
315315
});
316316
}
317317
}
@@ -339,7 +339,7 @@ function assertJsonWebKey(actual, expected) {
339339
assert.throws(() => converters.KeyUsage(bad, opts), {
340340
name: 'TypeError',
341341
code: 'ERR_INVALID_ARG_VALUE',
342-
message: `${prefix}: ${context} value '${bad}' is not a valid enum value of type KeyUsage.`,
342+
message: `${prefix}: ${context} '${bad}' is not a valid enum value of type KeyUsage.`,
343343
});
344344
}
345345
}

0 commit comments

Comments
 (0)