Add test for withValidation #786
Annotations
2 errors and 1 warning
Run npm test -w pkgs/typed-api-spec:
pkgs/typed-api-spec/src/fetch/validation.ts#L113
Error: {"reason":"body","issues":[{"code":"invalid_type","expected":"string","received":"undefined","path":["bodyNameRes"],"message":"Required"}],"name":"ZodError"}
❯ src/fetch/validation.ts:113:17
❯ handleResponseValidatorsError src/fetch/validation.ts:208:5
❯ src/fetch/validation.ts:112:9
❯ ftc src/fetch/validation.ts:162:5
❯ src/fetch/validation.test.ts:101:17
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Serialized Error: { reason: 'body', error: { stack: 'ZodError: [\n {\n "code": "invalid_type",\n "expected": "string",\n "received": "undefined",\n "path": [\n "bodyNameRes"\n ],\n "message": "Required"\n }\n]\n at Object.get error [as error] (file:///home/runner/work/typed-api-spec/typed-api-spec/node_modules/zod/lib/index.mjs:587:31)\n at toResult (/home/runner/work/typed-api-spec/typed-api-spec/pkgs/typed-api-spec/src/zod/index.ts:171:29)\n at /home/runner/work/typed-api-spec/typed-api-spec/pkgs/typed-api-spec/src/zod/index.ts:157:14\n at Object.validator.<computed> [as body] (/home/runner/work/typed-api-spec/typed-api-spec/pkgs/typed-api-spec/src/core/validator/response.ts:48:30)\n at Module.runResponseSpecValidator (/home/runner/work/typed-api-spec/typed-api-spec/pkgs/typed-api-spec/src/core/validator/response.ts:73:19)\n at ftc (/home/runner/work/typed-api-spec/typed-api-spec/pkgs/typed-api-spec/src/fetch/validation.ts:162:25)\n at processTicksAndRejections (node:internal/process/task_queues:95:5)\n at /home/runner/work/typed-api-spec/typed-api-spec/pkgs/typed-api-spec/src/fetch/validation.test.ts:101:17\n at file:///home/runner/work/typed-api-spec/typed-api-spec/node_modules/@vitest/runner/dist/index.js:533:5\n at runTest (file:///home/runner/work/typed-api-spec/typed-api-spec/node_modules/@vitest/runner/dist/index.js:1056:11)', issues: [ { code: 'invalid_type', expected: 'string', received: 'undefined', path: [ 'bodyNameRes' ], message: 'Required' } ], addIssue: 'Function<anonymous>', addIssues: 'Function<anonymous>', name: 'ZodError', constructor: 'Function<ZodError>', errors: [ { code: 'invalid_type', expected: 'string', received: 'undefined', path: [ 'bodyNameRes' ], message: 'Required' } ], format: 'Function<format>', toString: 'Function<toString>', message: '[\n {\n "code": "invalid_type",\n "expected": "string",\n "received": "undefined",\n "path": [\n "bodyNameRes"\n ],\n "message": "Required"\n }\n]', isEmpty: false, flatten: 'Function<flatten>', formErrors: { formErrors: [], fieldErrors: { bodyNameRes: [ 'Required' ] } } } }
|
Run npm test -w pkgs/typed-api-spec
Process completed with exit code 1.
|
ubuntu-latest pipelines will use ubuntu-24.04 soon. For more details, see https://github.com/actions/runner-images/issues/10636
|
Loading