test: add test coverage for DefaultConstructorSignature#1944
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.
|
📝 WalkthroughWalkthroughAdded a new component test for DefaultConstructorSignature in the Java Quarkus WebSocket client template and extended the AsyncAPI fixture with an additional websocket query parameter to support test scenarios covering null, undefined, empty array, and populated queryParams. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In
`@packages/templates/clients/websocket/java/quarkus/test/components/DefaultConstructorSignature.test.js`:
- Around line 34-37: The test description is incorrect: an empty array for
queryParams does not render nothing because DefaultConstructorSignature checks
for (!queryParams || !Array.isArray(queryParams)), so [] will render a zero-arg
constructor; update the test (the case currently named 'renders nothing when
queryParams is empty array') to reflect expected behavior—either change the test
title to something like 'renders zero-arg constructor when queryParams is empty
array' and assert the specific rendered output (e.g., the constructor string
produced by DefaultConstructorSignature for clientName "WebSocketClient"), or
keep the snapshot but rename the test to accurately describe that it renders a
zero-argument constructor; reference DefaultConstructorSignature and the test
name when making the change.
In
`@packages/templates/clients/websocket/test/__fixtures__/asyncapi-websocket-components.yml`:
- Around line 29-30: The YAML fixture has trailing whitespace after the key
"sessionId" (the line "sessionId: "); remove the extra spaces so the key is
exactly "sessionId:" with no trailing spaces, then save and re-run the
YAML/formatter or linter to ensure no other trailing whitespace remains.
🧹 Nitpick comments (1)
packages/templates/clients/websocket/java/quarkus/test/components/DefaultConstructorSignature.test.js (1)
24-27: Snapshot ofnullrender — consider an explicit assertion alongside the snapshot.When the component returns
null,render(null)returns an empty string. The snapshot will just be"", which is fragile and not very descriptive. Consider adding an explicit assertion likeexpect(result.trim()).toBe('')to make the intent clearer and guard against accidental non-empty output.This applies to the
undefinedtest (lines 29-32) as well.
...templates/clients/websocket/java/quarkus/test/components/DefaultConstructorSignature.test.js
Outdated
Show resolved
Hide resolved
packages/templates/clients/websocket/test/__fixtures__/asyncapi-websocket-components.yml
Outdated
Show resolved
Hide resolved
|
|
/rtm |
Co-authored-by: Harsh Gupta <harsh16official@gmail.com>



Description
Adds comprehensive integration tests for the
DefaultConstructorSignaturecomponent in the Java Quarkus WebSocket client template.Related Issue
Fixes #1888
Summary by CodeRabbit