test: add parseSSE coverage (src/client/stream.ts)#110
Merged
MiniMax-AI-Dev merged 1 commit intoMiniMax-AI:mainfrom Apr 20, 2026
Merged
test: add parseSSE coverage (src/client/stream.ts)#110MiniMax-AI-Dev merged 1 commit intoMiniMax-AI:mainfrom
MiniMax-AI-Dev merged 1 commit intoMiniMax-AI:mainfrom
Conversation
Adds 11 tests covering the SSE parsing function used by all
streaming commands (text chat, speech synthesize, etc.).
Coverage: 0% -> 100% line, 0% -> 100% branch
Test cases:
- Single and multiple sequential SSE events
- event:, id:, data: field parsing
- Comment lines (": ...") are skipped
- Multi-line data concatenation
- Lines without colon (malformed) are skipped
- Empty data field handling
- Null body response
- Reader lock release after iteration
4d4faef to
d9a1e6b
Compare
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
本 PR 为
src/client/stream.ts中的parseSSE函数添加了完整的测试覆盖。测试用例 / Test Cases
event:字段id:字段:开头的注释行被正确跳过\n正确连接data:(无值)被正确处理覆盖率 / Coverage
说明 / Notes
Summary
Adds 11 tests for
parseSSEinsrc/client/stream.ts, bringing it from 0% to 100% line and branch coverage.Why This Matters
parseSSEis core infrastructure used by all streaming commands (text chat, speech synthesize, video generation, etc.). Despite being a critical path, it had zero test coverage.Test Cases
event:fieldid:field:are skipped\ndata:with no value handled correctlyCoverage
Notes
Note: This PR uses a Chinese + English bilingual description. If this causes inconvenience, please let me know and I will adjust.