RocketChat / RocketChat/Rocket.Chat

test(message-parser): missing test coverage for isNodeOfType guard

Open Beginner friendly
#39,730 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: feature
Dominant language
TypeScript
Stars
46.1k
Forks
13.9k
Avg merge
3d 3h
Merged PRs (30d)
130

Description

Description

The isNodeOfType function exported from src/guards.ts has no dedicated test file in the message-parser package.

Running the test suite shows only 60% statement coverage and 0% branch coverage on guards.ts, meaning the guard function is never directly tested.

Affected file

packages/message-parser/src/guards.ts

Expected

A tests/guards.test.ts file should exist covering:

  • correct type narrowing for valid AST nodes
  • returning false for null, undefined, and non-objects
  • returning false when type field doesn't match

Actual

No guards.test.ts exists. The guard is only incidentally exercised through other tests.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading packages/message-parser/src/guards.ts and inspect nearby message-parser tests for AST node construction and assertions. Add tests/guards.test.ts covering valid type narrowing, nullish and non-object inputs, and mismatched type fields; run the message-parser test suite and confirm guards.ts branch coverage improves.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
testing-qa
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.