Skip to content

chore(message-parser): add test coverage for isNodeOfType guard#39737

Open
Harshith1702 wants to merge 1 commit intoRocketChat:developfrom
Harshith1702:fix/message-parser-extractFirstResult
Open

chore(message-parser): add test coverage for isNodeOfType guard#39737
Harshith1702 wants to merge 1 commit intoRocketChat:developfrom
Harshith1702:fix/message-parser-extractFirstResult

Conversation

@Harshith1702
Copy link
Copy Markdown

@Harshith1702 Harshith1702 commented Mar 19, 2026

guards.ts had 60% statement coverage and 0% branch coverage.

This PR adds a dedicated test suite covering all branches of isNodeOfType:

  • matching type returns true
  • null returns false
  • non-object returns false
  • mismatched type returns false
  • missing type property returns false
  • undefined returns false

All 594 tests pass.

Summary by CodeRabbit

  • Tests
    • Added comprehensive test coverage for message parsing type validation, increasing reliability across various input scenarios.

@dionisio-bot
Copy link
Copy Markdown
Contributor

dionisio-bot bot commented Mar 19, 2026

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is missing the 'stat: QA assured' label
  • This PR is missing the required milestone or project

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 19, 2026

🦋 Changeset detected

Latest commit: 4d08435

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 42 packages
Name Type
@rocket.chat/message-parser Patch
@rocket.chat/meteor Patch
@rocket.chat/core-services Patch
@rocket.chat/core-typings Patch
@rocket.chat/gazzodown Patch
@rocket.chat/livechat Patch
@rocket.chat/rest-typings Patch
@rocket.chat/pdf-worker Patch
rocketchat-services Patch
@rocket.chat/account-service Patch
@rocket.chat/authorization-service Patch
@rocket.chat/ddp-streamer Patch
@rocket.chat/omnichannel-transcript Patch
@rocket.chat/presence-service Patch
@rocket.chat/queue-worker Patch
@rocket.chat/abac Patch
@rocket.chat/federation-matrix Patch
@rocket.chat/network-broker Patch
@rocket.chat/omni-core-ee Patch
@rocket.chat/omnichannel-services Patch
@rocket.chat/presence Patch
@rocket.chat/uikit-playground Patch
@rocket.chat/api-client Patch
@rocket.chat/apps Patch
@rocket.chat/cron Patch
@rocket.chat/ddp-client Patch
@rocket.chat/fuselage-ui-kit Patch
@rocket.chat/http-router Patch
@rocket.chat/model-typings Patch
@rocket.chat/ui-avatar Patch
@rocket.chat/ui-client Patch
@rocket.chat/ui-contexts Patch
@rocket.chat/ui-voip Patch
@rocket.chat/web-ui-registration Patch
@rocket.chat/license Patch
@rocket.chat/media-calls Patch
@rocket.chat/models Patch
@rocket.chat/mock-providers Patch
@rocket.chat/ui-video-conf Patch
@rocket.chat/instance-status Patch
@rocket.chat/omni-core Patch
@rocket.chat/server-fetch Patch

Not sure what this means? Click here to learn what changesets are.

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

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 19, 2026

Walkthrough

A changeset entry and test suite were added for the @rocket.chat/message-parser package to document a patch version bump and provide test coverage for the isNodeOfType guard function, validating its behavior across various input scenarios including null, non-object, and type mismatch cases.

Changes

Cohort / File(s) Summary
Test Coverage Addition
.changeset/message-parser-guards-coverage.md, packages/message-parser/tests/guards.test.ts
Added changeset metadata documenting a patch version bump and introduced a new Jest test suite for the isNodeOfType guard function with test cases covering true/false return paths across null, non-object, matching/non-matching type, and undefined inputs.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Suggested labels

type: chore

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title accurately describes the main change: adding test coverage for the isNodeOfType guard function in the message-parser package.

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

📝 Coding Plan
  • Generate coding plan for human review comments

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
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 2 files

@Harshith1702 Harshith1702 changed the title [CHORE] message-parser: add test coverage for isNodeOfType guard chore(message-parser): add test coverage for isNodeOfType guard Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant