test: add test coverage for ClientConnector#2007
test: add test coverage for ClientConnector#2007asyncapi-bot merged 2 commits intoasyncapi:masterfrom
Conversation
|
What reviewer looks at during PR reviewThe following are ideal points maintainers look for during review. Reviewing these points yourself beforehand can help streamline the review process and reduce time to merge.
|
📝 WalkthroughWalkthroughIntroduces a new test file for the WebSocket Quarkus client's ClientConnector component. The test suite covers three scenarios for pathName handling (explicitly null, undefined default, and fixture-derived), parsing an AsyncAPI document fixture and verifying rendered output with snapshot assertions. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 6✅ Passed checks (6 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
packages/templates/clients/websocket/java/quarkus/test/components/ClientConnector.test.js (2)
17-27: Add a guard assertion after parsing to catch fixture issues early.If the fixture file is missing or contains invalid AsyncAPI,
parseResult.documentwill beundefined, causing all tests to fail with cryptic errors (e.g., "Cannot read properties of undefined"). A simple assertion right after parsing makes failures obvious.Proposed fix
const parseResult = await fromFile(parser, asyncapiFilePath).parse(); parsedAsyncAPIDocument = parseResult.document; + expect(parsedAsyncAPIDocument).toBeDefined(); channels = parsedAsyncAPIDocument.channels();
29-62: Consider adding tests forqueryandoperationsvariations.The linked issue (
#1934) calls for covering the component's "complex conditional logic." Currently, onlypathNameis varied across three tests. The component also branches onquery(line 5 ofClientConnector.js:query && Array.from(query.entries())) and filters operations viaoperations.filterBySend(). Tests withquery={null}and/or an AsyncAPI document with no send operations would exercise those paths.Also, the null and undefined
pathNametests exercise the exact same branch (!pathName → '/') and will produce identical snapshots — this is fine for explicitness, but adding the above variations would provide more meaningful coverage.
|
Thanks for the contribution. I’m closing this PR because, while there is an existing issue, it was not approved or opened for contribution before the pull request was submitted. Please make sure to follow the contribution guidelines, which explain when issues are considered ready for implementation and when pull requests are appropriate |
|
That was not specified in main issue and PR description. Reopening |
|
Thanks derberg for reopening the PR |
|
|
@Harsh16gupta for more smooth process please don't create PR directly let me drop a comment in issue so that easy for other maintainers to track. Thanks! |
|
/rtm |



Description
Adds comprehensive integration tests for the
ClientConnectorcomponent in the Java Quarkus WebSocket client template.Related Issue
Fixes #1934
This work was started after receiving maintainer approval in #1846.
Summary by CodeRabbit