Skip to content

test: add tests for overview component#1947

Merged
asyncapi-bot merged 4 commits intoasyncapi:masterfrom
batchu5:test/add-tests-overview-component
Feb 8, 2026
Merged

test: add tests for overview component#1947
asyncapi-bot merged 4 commits intoasyncapi:masterfrom
batchu5:test/add-tests-overview-component

Conversation

@batchu5
Copy link
Contributor

@batchu5 batchu5 commented Feb 7, 2026

Adds comprehensive tests for the Overview readme component to verify correct rendering and error behavior.

What’s included :

  • Snapshot test for rendering Overview with all required parameters
  • Explicit test asserting a thrown error when the required info prop is missing
  • Snapshot tests covering rendering when optional props (title, serverUrl) are omitted

Fixes #1939

Summary by CodeRabbit

  • Tests
    • Added a test suite for the Overview component covering rendering with/without title and server URL, snapshot assertions, and error-handling verification.
    • Included an AsyncAPI fixture containing a Production server configuration to support the new tests.

@changeset-bot
Copy link

changeset-bot bot commented Feb 7, 2026

⚠️ No Changeset found

Latest commit: 34749d9

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

Adds a new test suite for the Overview component and a small AsyncAPI fixture: tests parse an AsyncAPI YAML, derive serverUrl, render Overview with various prop combinations, perform snapshot assertions, and verify error handling when required props are missing.

Changes

Cohort / File(s) Summary
Overview tests
packages/components/test/components/Overview.test.js
New test suite: parses fixture via Parser/fromFile, derives info, title, and serverUrl, renders Overview with render from @asyncapi/generator-react-sdk, includes snapshot tests for complete and partial props, and checks TypeError for missing info.
AsyncAPI fixture
packages/components/test/__fixtures__/asyncapi-v3.yml
Adds a production server entry (host: api.example.com, protocol: ws) used by the tests to derive serverUrl.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Out of Scope Changes check ❓ Inconclusive All changes are scoped to test additions for the Overview component; however, the commit message 'update asyncapi_websocket_query path' suggests an undocumented path change requiring clarification. Clarify whether the asyncapi_websocket_query path modification in the fixture file is intentional and directly related to the Overview component tests, or if it represents an out-of-scope change.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'test: add tests for overview component' follows Conventional Commits format with 'test:' prefix, uses imperative mood ('add'), and clearly describes the main change.
Linked Issues check ✅ Passed The PR adds comprehensive unit tests for the Overview component including snapshot tests, error handling validation, and optional prop coverage, fulfilling all requirements from issue #1939.
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

No actionable comments were generated in the recent review. 🎉


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.

import { Overview } from '../../src/components/readme/Overview';

const parser = new Parser();
const asyncapi_websocket_query = path.resolve(__dirname, '../../../helpers/test/__fixtures__/asyncapi-websocket-query.yml');
Copy link
Member

Choose a reason for hiding this comment

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

yeah some other components incorrectly uses this fixture but this should be actually one inside components https://github.com/asyncapi/generator/blob/master/packages/components/test/__fixtures__/asyncapi-v3.yml
please use this one. you can make changes in fixtures only if testing requires.

@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
@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 8, 2026

@Adi-204
Copy link
Member

Adi-204 commented Feb 8, 2026

/rtm

@asyncapi-bot asyncapi-bot merged commit f2c8819 into asyncapi:master Feb 8, 2026
15 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Maintainers work Feb 8, 2026
@batchu5 batchu5 deleted the test/add-tests-overview-component branch February 8, 2026 16:33
@batchu5 batchu5 restored the test/add-tests-overview-component branch February 8, 2026 16:33
Harsh16gupta pushed a commit to Harsh16gupta/generator that referenced this pull request Feb 9, 2026
Co-authored-by: Varshitha Besthavemula <varshithabesthavemula@gmail.com>
Co-authored-by: Adi Boghawala <adiboghawala@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.

Add Tests for Overview Component.

3 participants