Skip to content

test: add test coverage for DefaultConstructorSignature#1944

Merged
asyncapi-bot merged 3 commits intoasyncapi:masterfrom
Harsh16gupta:test/DefaultConstructorSignature-1888
Feb 7, 2026
Merged

test: add test coverage for DefaultConstructorSignature#1944
asyncapi-bot merged 3 commits intoasyncapi:masterfrom
Harsh16gupta:test/DefaultConstructorSignature-1888

Conversation

@Harsh16gupta
Copy link
Contributor

@Harsh16gupta Harsh16gupta commented Feb 7, 2026

Description
Adds comprehensive integration tests for the DefaultConstructorSignature component in the Java Quarkus WebSocket client template.

Related Issue
Fixes #1888

image

Summary by CodeRabbit

  • Tests
    • Added integration tests for the constructor signature component covering null, undefined, empty, and populated query-parameter scenarios.
    • Updated test fixtures to include an optional sessionId query parameter for websocket channel testing.

@changeset-bot
Copy link

changeset-bot bot commented Feb 7, 2026

⚠️ No Changeset found

Latest commit: 40bf61b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@asyncapi-bot
Copy link
Contributor

What reviewer looks at during PR review

The 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.

  1. PR Title: Use a concise title that follows our Conventional Commits guidelines and clearly summarizes the change using imperative mood (it means spoken or written as if giving a command or instruction, like "add new helper for listing operations")

    Note - In Generator, prepend feat: or fix: in PR title only when PATCH/MINOR release must be triggered.

  2. PR Description: Clearly explain the issue being solved, summarize the changes made, and mention the related issue.

    Note - In Generator, we use Maintainers Work board to track progress. Ensure the PR Description includes Resolves #<issue-number> or Fixes #<issue-number> this will automatically close the linked issue when the PR is merged and helps automate the maintainers workflow.

  3. Documentation: Update the relevant Generator documentation to accurately reflect the changes introduced in the PR, ensuring users and contributors have up-to-date guidance.

  4. Comments and JSDoc: Write clear and consistent JSDoc comments for functions, including parameter types, return values, and error conditions, so others can easily understand and use the code.

  5. DRY Code: Ensure the code follows the Don't Repeat Yourself principle. Look out for duplicate logic that can be reused.

  6. Test Coverage: Ensure the new code is well-tested with meaningful test cases that pass consistently and cover all relevant edge cases.

  7. Commit History: Contributors should avoid force-pushing as much as possible. It makes it harder to track incremental changes and review the latest updates.

  8. Template Design Principles Alignment: While reviewing template-related changes in the packages/ directory, ensure they align with the Assumptions and Principles. If any principle feels outdated or no longer applicable, start a discussion these principles are meant to evolve with the project.

  9. Reduce Scope When Needed: If an issue or PR feels too large or complex, consider splitting it and creating follow-up issues. Smaller, focused PRs are easier to review and merge.

  10. Bot Comments: As reviewers, check that contributors have appropriately addressed comments or suggestions made by automated bots. If there are bot comments the reviewer disagrees with, react to them or mark them as resolved, so the review history remains clear and accurate.

@coderabbitai
Copy link

coderabbitai bot commented Feb 7, 2026

📝 Walkthrough

Walkthrough

Added 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

Cohort / File(s) Summary
Test file
packages/templates/clients/websocket/java/quarkus/test/components/DefaultConstructorSignature.test.js
Added a component test with four cases: renders nothing for null and undefined queryParams, renders default constructor for empty array, and renders constructor with query parameters when present. Uses AsyncAPI parser, fixture loading, and snapshot assertions.
Fixture
packages/templates/clients/websocket/test/__fixtures__/asyncapi-websocket-components.yml
Added sessionId query parameter under the websocket binding for testChannel to provide queryParams data for the tests.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title follows Conventional Commits with 'test:' prefix and uses imperative mood to clearly describe adding test coverage for the DefaultConstructorSignature component.
Linked Issues check ✅ Passed The PR successfully implements comprehensive test coverage for DefaultConstructorSignature.js component with 100% code coverage, directly addressing issue #1888's requirement to add unit tests.
Out of Scope Changes check ✅ Passed All changes are in-scope: new test file for DefaultConstructorSignature and updated fixture for ws binding query parameter, both directly supporting the test coverage objective.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 of null render — 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 like expect(result.trim()).toBe('') to make the intent clearer and guard against accidental non-empty output.

This applies to the undefined test (lines 29-32) as well.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 7, 2026

@Adi-204 Adi-204 self-assigned this Feb 7, 2026
@Adi-204 Adi-204 moved this to In Progress in Maintainers work Feb 7, 2026
@Adi-204
Copy link
Member

Adi-204 commented Feb 7, 2026

/rtm

@asyncapi-bot asyncapi-bot merged commit da5384d into asyncapi:master Feb 7, 2026
18 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Maintainers work Feb 7, 2026
@Harsh16gupta Harsh16gupta deleted the test/DefaultConstructorSignature-1888 branch February 7, 2026 16:25
Harsh16gupta added a commit to Harsh16gupta/generator that referenced this pull request Feb 9, 2026
Co-authored-by: Harsh Gupta <harsh16official@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[TEST] Add component tests for DefaultConstructorSignature.js (Java WebSocket Template)

3 participants