RocketChat / RocketChat/Rocket.Chat
test(message-parser): missing test coverage for isNodeOfType guard
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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