mirror of
https://github.com/nodejs/node.git
synced 2025-04-29 22:40:57 +00:00

Some checks are pending
Coverage Linux (without intl) / coverage-linux-without-intl (push) Waiting to run
Coverage Linux / coverage-linux (push) Waiting to run
Coverage Windows / coverage-windows (push) Waiting to run
Test and upload documentation to artifacts / build-docs (push) Waiting to run
Linters / lint-addon-docs (push) Waiting to run
Linters / lint-cpp (push) Waiting to run
Linters / format-cpp (push) Waiting to run
Linters / lint-js-and-md (push) Waiting to run
Linters / lint-py (push) Waiting to run
Linters / lint-yaml (push) Waiting to run
Linters / lint-sh (push) Waiting to run
Linters / lint-codeowners (push) Waiting to run
Linters / lint-pr-url (push) Waiting to run
Linters / lint-readme (push) Waiting to run
Notify on Push / Notify on Force Push on `main` (push) Waiting to run
Notify on Push / Notify on Push on `main` that lacks metadata (push) Waiting to run
Scorecard supply-chain security / Scorecard analysis (push) Waiting to run
PR-URL: https://github.com/nodejs/node/pull/56878 Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
47 lines
949 B
JavaScript
47 lines
949 B
JavaScript
'use strict';
|
|
|
|
require('../common');
|
|
|
|
const { URLPattern } = require('url');
|
|
const { throws } = require('assert');
|
|
|
|
// Verifies that calling URLPattern with no new keyword throws.
|
|
throws(() => URLPattern(), {
|
|
code: 'ERR_CONSTRUCT_CALL_REQUIRED',
|
|
});
|
|
|
|
// Verifies that type checks are performed on the arguments.
|
|
throws(() => new URLPattern(1), {
|
|
code: 'ERR_INVALID_ARG_TYPE',
|
|
});
|
|
|
|
throws(() => new URLPattern({}, 1), {
|
|
code: 'ERR_INVALID_ARG_TYPE',
|
|
});
|
|
|
|
throws(() => new URLPattern({}, '', 1), {
|
|
code: 'ERR_INVALID_ARG_TYPE',
|
|
});
|
|
|
|
throws(() => new URLPattern({}, { ignoreCase: '' }), {
|
|
code: 'ERR_INVALID_ARG_TYPE',
|
|
});
|
|
|
|
const pattern = new URLPattern();
|
|
|
|
throws(() => pattern.exec(1), {
|
|
code: 'ERR_INVALID_ARG_TYPE',
|
|
});
|
|
|
|
throws(() => pattern.exec('', 1), {
|
|
code: 'ERR_INVALID_ARG_TYPE',
|
|
});
|
|
|
|
throws(() => pattern.test(1), {
|
|
code: 'ERR_INVALID_ARG_TYPE',
|
|
});
|
|
|
|
throws(() => pattern.test('', 1), {
|
|
code: 'ERR_INVALID_ARG_TYPE',
|
|
});
|