feat: implement validation middleware tests with tests and docs#152
Open
Johnsmichael150 wants to merge 2 commits intoTalenttrust:mainfrom
Open
feat: implement validation middleware tests with tests and docs#152Johnsmichael150 wants to merge 2 commits intoTalenttrust:mainfrom
Johnsmichael150 wants to merge 2 commits intoTalenttrust:mainfrom
Conversation
- Add unit tests for validateRequest, validateParams, validateQuery (validation.ts) - Add unit tests for createRequestValidationMiddleware (requestValidation.ts) - Expand validateSegment tests: NaN/Infinity, null, array, empty schema (requestSchema.ts) - Expand validateSchema tests: strict schemas, UUID params, error forwarding (validate.middleware.ts) - Add docs/backend/validation-middleware-tests.md - Install missing zod dependency
|
@Johnsmichael150 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds comprehensive unit tests for all three validation middleware layers and the core validation engine. Also fixes a missing
zodruntime dependency.Changes
src/middleware/validation.test.tsvalidateRequest,validateParams,validateQuerysrc/middleware/requestValidation.test.tscreateRequestValidationMiddlewaresrc/middleware/validate.middleware.test.tsvalidateSchemasrc/validation/requestSchema.test.tsvalidateSegmentdocs/backend/validation-middleware-tests.mdpackage.json/package-lock.jsonzodruntime dependencyTest Coverage
validateRequest/validateParams/validateQuery(validation.ts)next()with no argumentsdetails.strict()schemas reject extra fieldscreateRequestValidationMiddleware(requestValidation.ts)validateSchema(validate.middleware.ts)next(error), not serialized to clientvalidateSegment(requestSchema.ts)Security Notes
How to Test
Related
docs/backend/validation-middleware-tests.mdfor full coverage referencedocs/backend/request-validation-framework.mdfor implementation details