-
Notifications
You must be signed in to change notification settings - Fork 1.6k
test(core): add unit tests for normalizeHeaders and createFetchWithInit #1374
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
commit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds comprehensive unit tests for two utility functions (normalizeHeaders and createFetchWithInit) in the transport module that previously lacked dedicated test coverage. The tests verify various input formats for header normalization and proper merging behavior for fetch initialization options.
Key changes:
- New test file with 142 lines covering two utility functions
- Tests for
normalizeHeadersvalidate handling of undefined, Headers instances, arrays of tuples, and plain objects - Tests for
createFetchWithInitverify base initialization passthrough, option merging, and header merging precedence
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
76779f6 to
3f7ef90
Compare
Add unit tests for
normalizeHeadersandcreateFetchWithInitinpackages/core/src/shared/transport.ts.Motivation and Context
These utility functions are used by both
SSEClientTransportandStreamableHTTPClientTransportbut had no dedicated unit tests. Adding coverage helps catch regressions and documents expected behavior.How Has This Been Tested?
Breaking Changes
None. Test-only change.
Types of changes
(This is a test-only change)
Checklist
Additional context
Tests cover:
normalizeHeaders: undefined, Headers instance, array of tuples, plain objectscreateFetchWithInit: base init passthrough, option merging, header merging precedence