test(aws-lambda): expand handler unit tests for processors and createResult#4744
Open
rokasta12 wants to merge 2 commits intohonojs:mainfrom
Open
test(aws-lambda): expand handler unit tests for processors and createResult#4744rokasta12 wants to merge 2 commits intohonojs:mainfrom
rokasta12 wants to merge 2 commits intohonojs:mainfrom
Conversation
…Result Add 48 new unit tests covering: - ALBProcessor: createRequest, headers, multiValueHeaders, query strings, multiValueQueryStringParameters, cookies (single/multi-value) - createResult: multiValueHeaders format, content-encoding binary, set-cookie handling for V1/V2/ALB/Lattice, status codes, empty body - Base64 body decoding for V1 and V2 events - getDomainName fallback: host header, multiValueHeaders host - getProcessor: all 4 processor types (ALB, V1, V2, Lattice) - Non-ASCII header sanitization for V1 multiValueHeaders and ALB - LatticeV2Processor: query string behavior, set-cookie handling handler.ts coverage: 77% statements, 90% branches, 85% functions
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4744 +/- ##
=======================================
Coverage 91.48% 91.48%
=======================================
Files 177 177
Lines 11556 11556
Branches 3358 3359 +1
=======================================
Hits 10572 10572
Misses 983 983
Partials 1 1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
The author should do the following, if applicable
bun run format:fix && bun run lint:fixto format the codeAdds 48 new unit tests to
src/adapter/aws-lambda/handler.test.ts, expanding coverage from 12 to 60 test cases. The handler.ts coverage improves to 77% statements, 90% branches, 85% functions.What's covered
ALBProcessor (previously untested at the unit level)
createRequestwith single-value and multi-value headersgetQueryStringwithqueryStringParametersandmultiValueQueryStringParametersmultiValueQueryStringParametersoverqueryStringParameterscreateResult
multiValueHeadersvsheadersformat based on event typecontent-encodingbinary detection (gzip/br triggering base64)set-cookiehandling for all 4 event types:result.cookiesarrayresult.multiValueHeaders['set-cookie'],result.multiValueHeaders['set-cookie'],intoresult.headersgetDomainName fallback chain
requestContext.domainName(API Gateway)headers.host(ALB)multiValueHeaders.host(ALB with multi-value enabled)getProcessor
ALBProcessor,EventV1Processor,EventV2Processor,LatticeV2ProcessorNon-ASCII header sanitization
multiValueHeaderswith non-ASCII valuesmultiValueHeadersjoining with;and sanitizingBase64 body decoding
isBase64Encoded: trueLatticeV2Processor
'')