feat: URL validator #4
Annotations
10 errors and 2 warnings
src/__tests__/url.test.ts > UrlValidator with default options > should parse a valid URL:
packages/validators/src/url/utils.ts#L19
TypeError: Invalid URL
❯ Module.resolveRelativeUrl src/url/utils.ts:19:7
❯ Object.transform src/url/schema.ts:9:25
❯ ZodEffects._parse ../../node_modules/.pnpm/[email protected]/node_modules/zod/lib/index.mjs:3724:39
❯ ZodEffects._parseSync ../../node_modules/.pnpm/[email protected]/node_modules/zod/lib/index.mjs:678:29
❯ ZodEffects._parse ../../node_modules/.pnpm/[email protected]/node_modules/zod/lib/index.mjs:3688:48
❯ ZodEffects._parseSync ../../node_modules/.pnpm/[email protected]/node_modules/zod/lib/index.mjs:678:29
❯ ZodEffects.safeParse ../../node_modules/.pnpm/[email protected]/node_modules/zod/lib/index.mjs:708:29
❯ UrlValidator.parse src/url/index.ts:21:32
❯ src/__tests__/url.test.ts:10:27
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Serialized Error: { code: 'ERR_INVALID_URL', input: 'undefined' }
|
src/__tests__/url.test.ts > UrlValidator with default options > should throw an error when the protocol is not http or https:
packages/validators/src/__tests__/url.test.ts#L15
AssertionError: expected error to be instance of UrlValidationError
- Expected:
[Function UrlValidationError]
+ Received:
[TypeError: Invalid URL]
❯ src/__tests__/url.test.ts:15:56
|
src/__tests__/url.test.ts > UrlValidator with default options > should allow any host when no host whitelist is provided:
packages/validators/src/__tests__/url.test.ts#L21
AssertionError: expected [Function] to not throw an error but 'TypeError: Invalid URL' was thrown
- Expected:
undefined
+ Received:
"TypeError: Invalid URL"
❯ src/__tests__/url.test.ts:21:62
|
src/__tests__/url.test.ts > UrlValidator with default options > should not allow Next.js dynamic routes:
packages/validators/src/__tests__/url.test.ts#L31
AssertionError: expected error to be instance of UrlValidationError
- Expected:
[Function UrlValidationError]
+ Received:
[TypeError: Invalid URL]
❯ src/__tests__/url.test.ts:31:70
|
src/__tests__/url.test.ts > UrlValidator with default options > should prevent XSS attacks:
packages/validators/src/__tests__/url.test.ts#L46
AssertionError: expected error to be instance of UrlValidationError
- Expected:
[Function UrlValidationError]
+ Received:
[TypeError: Invalid URL]
❯ src/__tests__/url.test.ts:46:62
|
src/__tests__/url.test.ts > UrlValidator with custom protocol whitelist > should not throw an error when the protocol on the whitelist:
packages/validators/src/__tests__/url.test.ts#L60
AssertionError: expected [Function] to not throw an error but 'TypeError: Invalid URL' was thrown
- Expected:
undefined
+ Received:
"TypeError: Invalid URL"
❯ src/__tests__/url.test.ts:60:62
|
src/__tests__/url.test.ts > UrlValidator with custom protocol whitelist > should throw an error when the protocol is not on the whitelist:
packages/validators/src/__tests__/url.test.ts#L66
AssertionError: expected error to be instance of UrlValidationError
- Expected:
[Function UrlValidationError]
+ Received:
[TypeError: Invalid URL]
❯ src/__tests__/url.test.ts:66:56
|
src/__tests__/url.test.ts > UrlValidator with custom host whitelist > should not throw an error when the host is on the whitelist:
packages/validators/src/__tests__/url.test.ts#L83
AssertionError: expected [Function] to not throw an error but 'TypeError: Invalid URL' was thrown
- Expected:
undefined
+ Received:
"TypeError: Invalid URL"
❯ src/__tests__/url.test.ts:83:62
|
src/__tests__/url.test.ts > UrlValidator with custom host whitelist > should throw an error when the host is not on the whitelist:
packages/validators/src/__tests__/url.test.ts#L87
AssertionError: expected error to be instance of UrlValidationError
- Expected:
[Function UrlValidationError]
+ Received:
[TypeError: Invalid URL]
❯ src/__tests__/url.test.ts:87:58
|
Run tests
Process completed with exit code 1.
|
build
The following actions uses Node.js version which is deprecated and will be forced to run on node20: actions/checkout@v3, actions/setup-node@v3. For more info: https://github.blog/changelog/2024-03-07-github-actions-all-actions-will-run-on-node20-instead-of-node16-by-default/
|
Run tests
The following actions uses Node.js version which is deprecated and will be forced to run on node20: actions/checkout@v3, actions/setup-node@v3. For more info: https://github.blog/changelog/2024-03-07-github-actions-all-actions-will-run-on-node20-instead-of-node16-by-default/
|