test: add ConnectorFields component tests#2103
Conversation
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds an integration test suite for the ConnectorFields component that parses an AsyncAPI websocket fixture, derives channel query parameters, and snapshot-tests rendering for four scenarios: null, omitted/undefined, empty array, and a populated derived array. ChangesConnectorFields Component Test
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 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)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add 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.
Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.
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.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/templates/clients/websocket/java/quarkus/test/components/ConnectorFields.test.js (1)
15-60: ⚡ Quick winAdd JSDoc for test/beforeAll function callbacks to match repository JS documentation rules.
The callbacks introduced on Line 15 and Lines 24/34/43/53 are functions without JSDoc. Please document params/returns/error behavior consistently for this JS file.
As per coding guidelines, "
**/*.{js,ts,jsx,tsx}: Write clear and consistent JSDoc comments for functions, including parameter types, return values, and error conditions".🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/templates/clients/websocket/java/quarkus/test/components/ConnectorFields.test.js` around lines 15 - 60, Add JSDoc comments for the asynchronous beforeAll callback and each test callback in ConnectorFields.test.js: document the parameters (none for these callbacks), the return type (Promise<void> for the async beforeAll, void for sync tests), and any error behavior thrown by parsing/rendering (e.g., may throw if parsing fails); place the JSDoc immediately above the beforeAll(...) block and each test('...', () => {...}) callback to satisfy the repository's JS documentation rules and make it clear what each callback returns and what errors it may propagate.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@packages/templates/clients/websocket/java/quarkus/test/components/ConnectorFields.test.js`:
- Around line 53-60: Add an explicit precondition assertion that the fixture
actually contains data before exercising the "with base URI" branch: before
rendering ConnectorFields in the test (the test function named 'renders
connector field with base URI config when queryParamsArray has data from
fixture'), assert that queryParamsArray is non-empty (e.g., check
queryParamsArray.length > 0 or expect(queryParamsArray).not.toHaveLength(0)) so
the test will fail if the fixture changes and will reliably exercise the
base-URI conditional.
---
Nitpick comments:
In
`@packages/templates/clients/websocket/java/quarkus/test/components/ConnectorFields.test.js`:
- Around line 15-60: Add JSDoc comments for the asynchronous beforeAll callback
and each test callback in ConnectorFields.test.js: document the parameters (none
for these callbacks), the return type (Promise<void> for the async beforeAll,
void for sync tests), and any error behavior thrown by parsing/rendering (e.g.,
may throw if parsing fails); place the JSDoc immediately above the
beforeAll(...) block and each test('...', () => {...}) callback to satisfy the
repository's JS documentation rules and make it clear what each callback returns
and what errors it may propagate.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 8b8bc5f9-1f8f-4d2e-b7d1-77999f32cd0b
⛔ Files ignored due to path filters (1)
packages/templates/clients/websocket/java/quarkus/test/components/__snapshots__/ConnectorFields.test.js.snapis excluded by!**/*.snap
📒 Files selected for processing (1)
packages/templates/clients/websocket/java/quarkus/test/components/ConnectorFields.test.js
|
|
@Adi-204 can you check this pr now |
| const queryParams = getQueryParams(channels); | ||
| queryParamsArray = queryParams ? Array.from(queryParams.entries()) : null; |
There was a problem hiding this comment.
@techmannih beforeAll parses the file and computes queryParamsArray for all 4 tests, but the first 3 ignore it entirely they use hardcoded null, undefined, and []. So I think we can do better and just move this code in last testcase where it actually uses it.



Description
Adds component test coverage for the Java Quarkus WebSocket template
ConnectorFieldscomponent.The new tests verify that the component renders the injected
WebSocketConnectorfield in all cases and only renders the@ConfigPropertybase URI field when query parameters are present.Closes #2014
Validation
npm testfrompackages/templates/clients/websocket/java/quarkusSummary by CodeRabbit