Skip to content

test(message-parser): decouple parser tests from production helpers#39086

Merged
ggazzo merged 2 commits intoRocketChat:developfrom
Shreyas2004wagh:fix/message-parser-oracle-coupling-tests
Feb 26, 2026
Merged

test(message-parser): decouple parser tests from production helpers#39086
ggazzo merged 2 commits intoRocketChat:developfrom
Shreyas2004wagh:fix/message-parser-oracle-coupling-tests

Conversation

@Shreyas2004wagh
Copy link
Copy Markdown
Contributor

@Shreyas2004wagh Shreyas2004wagh commented Feb 26, 2026

Summary

  • add test-only AST builders in packages/message-parser/tests/helpers.ts
  • switch parser test suites to use local test builders instead of ../src/utils
  • replace oracle-coupled expectations in timestamp and URL parser tests with explicit expected literals
  • keep autoLink production import only for dedicated helper behavior assertions

Why

Parser tests were deriving expected output from the same production helpers used by parsing logic (timestamp*, autoLink), which can mask regressions when helper behavior changes.

Validation

  • yarn workspace '@rocket.chat/message-parser' exec eslint tests/helpers.ts tests/*.test.ts

Fix #39085
Fix #39295
COMM-144

Summary by CodeRabbit

  • Tests

    • Centralized test helpers to improve test maintainability and consistency.
    • Expanded timestamp parsing coverage, including relative-hour scenarios.
    • Updated URL-related tests to use explicit link expectations for clearer behavior.
  • Refactor

    • Consolidated test helper imports across the test suite for uniformity.

Task: ARCH-2009

@dionisio-bot
Copy link
Copy Markdown
Contributor

dionisio-bot bot commented Feb 26, 2026

Looks like this PR is ready to merge! 🎉
If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Feb 26, 2026

⚠️ No Changeset found

Latest commit: e85dc5d

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

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Feb 26, 2026

Walkthrough

Introduces a new test helpers module at packages/message-parser/tests/helpers.ts and updates ~30 message-parser test files to import helpers locally instead of from production utils; a few tests (timestamp, url) also adjust expectations to use new local factories and explicit node shapes.

Changes

Cohort / File(s) Summary
New Test Helpers Module
packages/message-parser/tests/helpers.ts
Adds a comprehensive test factory module (generate + 30+ helpers) producing typed token-like objects (e.g., paragraph, plain, bold, italic, strike, link, image, emoji, katex, listItem, heading, code, task, lineBreak, timestampNode, etc.). Centralizes test node construction with defaults and consistent shapes.
Import Path Updates (many tests)
packages/message-parser/tests/abuse.test.ts, packages/message-parser/tests/any.test.ts, packages/message-parser/tests/blockquotes.test.ts, packages/message-parser/tests/codeFence.test.ts, packages/message-parser/tests/color.test.ts, packages/message-parser/tests/email.test.ts, packages/message-parser/tests/emoji.test.ts, packages/message-parser/tests/emoticons.test.ts, packages/message-parser/tests/emphasis.test.ts, packages/message-parser/tests/emphasisWithEmoticons.test.ts, packages/message-parser/tests/escaped.test.ts, packages/message-parser/tests/heading.test.ts, packages/message-parser/tests/image.test.ts, packages/message-parser/tests/inlineCode.test.ts, packages/message-parser/tests/inlineCodeStrike.test.ts, packages/message-parser/tests/katex.test.ts, packages/message-parser/tests/lineBreak.test.ts, packages/message-parser/tests/mention.test.ts, packages/message-parser/tests/orderedList.test.ts, packages/message-parser/tests/phoneNumber.test.ts, packages/message-parser/tests/spoiler.test.ts, packages/message-parser/tests/spoilerBlock.test.ts, packages/message-parser/tests/strikethrough.test.ts, packages/message-parser/tests/strongEmphasis.test.ts, packages/message-parser/tests/tasks.test.ts, packages/message-parser/tests/unorderedList.test.ts
Switched imports from production ../src/utils to local ./helpers in tests. No changes to test assertions or parsing logic in these files beyond import source adjustments.
Timestamp Tests
packages/message-parser/tests/timestamp.test.ts
Replaced production-derived helpers with local timestampNode(...) factory and plain fallbacks; added relative-hour parsing test suite using Jest fake timers and updated expectations to use explicit node shapes rather than production helper outputs.
URL Tests
packages/message-parser/tests/url.test.ts
Adjusted expectations: replaced several uses of autoLink(...) with explicit link(...) nodes from local helpers, and updated some test cases to include explicit plain child nodes for link labels; autoLink retained only where specifically tested.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • ggazzo
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed The PR fully addresses all coding requirements from issue #39085: new test helpers in helpers.ts replace production imports, timestamp.test.ts and url.test.ts use explicit values, oracle coupling is eliminated.
Out of Scope Changes check ✅ Passed All changes directly support the stated objective of decoupling tests from production helpers; test import path updates and the new helpers.ts module are in-scope changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title 'decouple parser tests from production helpers' clearly and specifically summarizes the main change—moving tests from using production utility imports to a dedicated test helpers module to eliminate oracle coupling.

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


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

@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: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/message-parser/tests/timestamp.test.ts`:
- Around line 43-45: Tests contain three identical cases using the same input
string and expected AST (timestampNode('1753178400','R') inside paragraph);
remove the duplicate entries so only one of these identical test vectors
remains, or replace duplicates with distinct cases if additional coverage was
intended; locate the duplicate array entries in timestamp.test.ts (the lines
with timestampNode and paragraph) and delete or modify the extra two so each
test case is unique.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5f6b887 and 1c0ca6f.

📒 Files selected for processing (30)
  • packages/message-parser/tests/abuse.test.ts
  • packages/message-parser/tests/any.test.ts
  • packages/message-parser/tests/blockquotes.test.ts
  • packages/message-parser/tests/codeFence.test.ts
  • packages/message-parser/tests/color.test.ts
  • packages/message-parser/tests/email.test.ts
  • packages/message-parser/tests/emoji.test.ts
  • packages/message-parser/tests/emoticons.test.ts
  • packages/message-parser/tests/emphasis.test.ts
  • packages/message-parser/tests/emphasisWithEmoticons.test.ts
  • packages/message-parser/tests/escaped.test.ts
  • packages/message-parser/tests/heading.test.ts
  • packages/message-parser/tests/helpers.ts
  • packages/message-parser/tests/image.test.ts
  • packages/message-parser/tests/inlineCode.test.ts
  • packages/message-parser/tests/inlineCodeStrike.test.ts
  • packages/message-parser/tests/katex.test.ts
  • packages/message-parser/tests/lineBreak.test.ts
  • packages/message-parser/tests/link.test.ts
  • packages/message-parser/tests/mention.test.ts
  • packages/message-parser/tests/orderedList.test.ts
  • packages/message-parser/tests/phoneNumber.test.ts
  • packages/message-parser/tests/spoiler.test.ts
  • packages/message-parser/tests/spoilerBlock.test.ts
  • packages/message-parser/tests/strikethrough.test.ts
  • packages/message-parser/tests/strongEmphasis.test.ts
  • packages/message-parser/tests/tasks.test.ts
  • packages/message-parser/tests/timestamp.test.ts
  • packages/message-parser/tests/unorderedList.test.ts
  • packages/message-parser/tests/url.test.ts
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: CodeQL-Build
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation

Files:

  • packages/message-parser/tests/strongEmphasis.test.ts
  • packages/message-parser/tests/heading.test.ts
  • packages/message-parser/tests/blockquotes.test.ts
  • packages/message-parser/tests/emoticons.test.ts
  • packages/message-parser/tests/any.test.ts
  • packages/message-parser/tests/link.test.ts
  • packages/message-parser/tests/image.test.ts
  • packages/message-parser/tests/orderedList.test.ts
  • packages/message-parser/tests/emphasisWithEmoticons.test.ts
  • packages/message-parser/tests/mention.test.ts
  • packages/message-parser/tests/timestamp.test.ts
  • packages/message-parser/tests/inlineCode.test.ts
  • packages/message-parser/tests/codeFence.test.ts
  • packages/message-parser/tests/abuse.test.ts
  • packages/message-parser/tests/tasks.test.ts
  • packages/message-parser/tests/spoilerBlock.test.ts
  • packages/message-parser/tests/strikethrough.test.ts
  • packages/message-parser/tests/emphasis.test.ts
  • packages/message-parser/tests/inlineCodeStrike.test.ts
  • packages/message-parser/tests/url.test.ts
  • packages/message-parser/tests/katex.test.ts
  • packages/message-parser/tests/email.test.ts
  • packages/message-parser/tests/escaped.test.ts
  • packages/message-parser/tests/lineBreak.test.ts
  • packages/message-parser/tests/unorderedList.test.ts
  • packages/message-parser/tests/color.test.ts
  • packages/message-parser/tests/spoiler.test.ts
  • packages/message-parser/tests/emoji.test.ts
  • packages/message-parser/tests/phoneNumber.test.ts
  • packages/message-parser/tests/helpers.ts
🧠 Learnings (20)
📓 Common learnings
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 38493
File: apps/meteor/tests/e2e/page-objects/fragments/home-content.ts:60-82
Timestamp: 2026-02-24T19:36:55.089Z
Learning: In RocketChat/Rocket.Chat e2e tests (apps/meteor/tests/e2e/page-objects/fragments/home-content.ts), thread message preview listitems do not have aria-roledescription="message", so lastThreadMessagePreview locator cannot be scoped to messageListItems (which filters for aria-roledescription="message"). It should remain scoped to page.getByRole('listitem') or mainMessageList.getByRole('listitem').
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Utilize Playwright fixtures (`test`, `page`, `expect`) for consistency in test files
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Group related tests in the same file
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/page-objects/**/*.ts : Utilize existing page objects pattern from `apps/meteor/tests/e2e/page-objects/`
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Ensure tests run reliably in parallel without shared state conflicts
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Maintain test isolation between test cases in Playwright tests
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use `test.beforeAll()` and `test.afterAll()` for setup/teardown in Playwright tests
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use `test.step()` for complex test scenarios to improve organization in Playwright tests
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.{ts,spec.ts} : Store commonly used locators in variables/constants for reuse
📚 Learning: 2025-12-10T21:00:54.909Z
Learnt from: KevLehman
Repo: RocketChat/Rocket.Chat PR: 37091
File: ee/packages/abac/jest.config.ts:4-7
Timestamp: 2025-12-10T21:00:54.909Z
Learning: Rocket.Chat monorepo: Jest testMatch pattern '<rootDir>/src/**/*.spec.(ts|js|mjs)' is valid in this repo and used across multiple packages (e.g., packages/tools, ee/packages/omnichannel-services). Do not flag it as invalid in future reviews.

Applied to files:

  • packages/message-parser/tests/strongEmphasis.test.ts
  • packages/message-parser/tests/blockquotes.test.ts
  • packages/message-parser/tests/emoticons.test.ts
  • packages/message-parser/tests/any.test.ts
  • packages/message-parser/tests/link.test.ts
  • packages/message-parser/tests/image.test.ts
  • packages/message-parser/tests/orderedList.test.ts
  • packages/message-parser/tests/emphasisWithEmoticons.test.ts
  • packages/message-parser/tests/mention.test.ts
  • packages/message-parser/tests/inlineCode.test.ts
  • packages/message-parser/tests/codeFence.test.ts
  • packages/message-parser/tests/abuse.test.ts
  • packages/message-parser/tests/tasks.test.ts
  • packages/message-parser/tests/spoilerBlock.test.ts
  • packages/message-parser/tests/strikethrough.test.ts
  • packages/message-parser/tests/emphasis.test.ts
  • packages/message-parser/tests/inlineCodeStrike.test.ts
  • packages/message-parser/tests/url.test.ts
  • packages/message-parser/tests/katex.test.ts
  • packages/message-parser/tests/email.test.ts
  • packages/message-parser/tests/escaped.test.ts
  • packages/message-parser/tests/lineBreak.test.ts
  • packages/message-parser/tests/unorderedList.test.ts
  • packages/message-parser/tests/color.test.ts
  • packages/message-parser/tests/spoiler.test.ts
  • packages/message-parser/tests/emoji.test.ts
  • packages/message-parser/tests/phoneNumber.test.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Utilize Playwright fixtures (`test`, `page`, `expect`) for consistency in test files

Applied to files:

  • packages/message-parser/tests/strongEmphasis.test.ts
  • packages/message-parser/tests/heading.test.ts
  • packages/message-parser/tests/blockquotes.test.ts
  • packages/message-parser/tests/any.test.ts
  • packages/message-parser/tests/link.test.ts
  • packages/message-parser/tests/image.test.ts
  • packages/message-parser/tests/orderedList.test.ts
  • packages/message-parser/tests/emphasisWithEmoticons.test.ts
  • packages/message-parser/tests/mention.test.ts
  • packages/message-parser/tests/timestamp.test.ts
  • packages/message-parser/tests/inlineCode.test.ts
  • packages/message-parser/tests/codeFence.test.ts
  • packages/message-parser/tests/abuse.test.ts
  • packages/message-parser/tests/tasks.test.ts
  • packages/message-parser/tests/spoilerBlock.test.ts
  • packages/message-parser/tests/strikethrough.test.ts
  • packages/message-parser/tests/emphasis.test.ts
  • packages/message-parser/tests/inlineCodeStrike.test.ts
  • packages/message-parser/tests/url.test.ts
  • packages/message-parser/tests/katex.test.ts
  • packages/message-parser/tests/email.test.ts
  • packages/message-parser/tests/escaped.test.ts
  • packages/message-parser/tests/lineBreak.test.ts
  • packages/message-parser/tests/unorderedList.test.ts
  • packages/message-parser/tests/color.test.ts
  • packages/message-parser/tests/spoiler.test.ts
  • packages/message-parser/tests/emoji.test.ts
  • packages/message-parser/tests/phoneNumber.test.ts
  • packages/message-parser/tests/helpers.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use `expect` matchers for assertions (`toEqual`, `toContain`, `toBeTruthy`, `toHaveLength`, etc.) instead of `assert` statements in Playwright tests

Applied to files:

  • packages/message-parser/tests/strongEmphasis.test.ts
  • packages/message-parser/tests/heading.test.ts
  • packages/message-parser/tests/blockquotes.test.ts
  • packages/message-parser/tests/any.test.ts
  • packages/message-parser/tests/link.test.ts
  • packages/message-parser/tests/orderedList.test.ts
  • packages/message-parser/tests/emphasisWithEmoticons.test.ts
  • packages/message-parser/tests/timestamp.test.ts
  • packages/message-parser/tests/inlineCode.test.ts
  • packages/message-parser/tests/codeFence.test.ts
  • packages/message-parser/tests/abuse.test.ts
  • packages/message-parser/tests/strikethrough.test.ts
  • packages/message-parser/tests/emphasis.test.ts
  • packages/message-parser/tests/inlineCodeStrike.test.ts
  • packages/message-parser/tests/url.test.ts
  • packages/message-parser/tests/katex.test.ts
  • packages/message-parser/tests/email.test.ts
  • packages/message-parser/tests/lineBreak.test.ts
  • packages/message-parser/tests/unorderedList.test.ts
  • packages/message-parser/tests/color.test.ts
  • packages/message-parser/tests/spoiler.test.ts
  • packages/message-parser/tests/helpers.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Ensure tests run reliably in parallel without shared state conflicts

Applied to files:

  • packages/message-parser/tests/strongEmphasis.test.ts
  • packages/message-parser/tests/blockquotes.test.ts
  • packages/message-parser/tests/any.test.ts
  • packages/message-parser/tests/link.test.ts
  • packages/message-parser/tests/image.test.ts
  • packages/message-parser/tests/orderedList.test.ts
  • packages/message-parser/tests/emphasisWithEmoticons.test.ts
  • packages/message-parser/tests/mention.test.ts
  • packages/message-parser/tests/timestamp.test.ts
  • packages/message-parser/tests/inlineCode.test.ts
  • packages/message-parser/tests/codeFence.test.ts
  • packages/message-parser/tests/abuse.test.ts
  • packages/message-parser/tests/tasks.test.ts
  • packages/message-parser/tests/spoilerBlock.test.ts
  • packages/message-parser/tests/strikethrough.test.ts
  • packages/message-parser/tests/emphasis.test.ts
  • packages/message-parser/tests/inlineCodeStrike.test.ts
  • packages/message-parser/tests/url.test.ts
  • packages/message-parser/tests/katex.test.ts
  • packages/message-parser/tests/email.test.ts
  • packages/message-parser/tests/lineBreak.test.ts
  • packages/message-parser/tests/unorderedList.test.ts
  • packages/message-parser/tests/color.test.ts
  • packages/message-parser/tests/spoiler.test.ts
  • packages/message-parser/tests/emoji.test.ts
  • packages/message-parser/tests/phoneNumber.test.ts
📚 Learning: 2025-12-16T17:29:45.163Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 37834
File: apps/meteor/tests/e2e/page-objects/fragments/admin-flextab-emoji.ts:12-22
Timestamp: 2025-12-16T17:29:45.163Z
Learning: In page object files under `apps/meteor/tests/e2e/page-objects/`, always import `expect` from `../../utils/test` (Playwright's async expect), not from Jest. Jest's `expect` has a synchronous signature and will cause TypeScript errors when used with web-first assertions like `toBeVisible()`.

Applied to files:

  • packages/message-parser/tests/strongEmphasis.test.ts
  • packages/message-parser/tests/link.test.ts
  • packages/message-parser/tests/mention.test.ts
  • packages/message-parser/tests/timestamp.test.ts
  • packages/message-parser/tests/inlineCode.test.ts
  • packages/message-parser/tests/codeFence.test.ts
  • packages/message-parser/tests/abuse.test.ts
  • packages/message-parser/tests/tasks.test.ts
  • packages/message-parser/tests/spoilerBlock.test.ts
  • packages/message-parser/tests/strikethrough.test.ts
  • packages/message-parser/tests/emphasis.test.ts
  • packages/message-parser/tests/inlineCodeStrike.test.ts
  • packages/message-parser/tests/katex.test.ts
  • packages/message-parser/tests/email.test.ts
  • packages/message-parser/tests/color.test.ts
  • packages/message-parser/tests/spoiler.test.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use `test.step()` for complex test scenarios to improve organization in Playwright tests

Applied to files:

  • packages/message-parser/tests/strongEmphasis.test.ts
  • packages/message-parser/tests/blockquotes.test.ts
  • packages/message-parser/tests/any.test.ts
  • packages/message-parser/tests/link.test.ts
  • packages/message-parser/tests/orderedList.test.ts
  • packages/message-parser/tests/emphasisWithEmoticons.test.ts
  • packages/message-parser/tests/timestamp.test.ts
  • packages/message-parser/tests/inlineCode.test.ts
  • packages/message-parser/tests/codeFence.test.ts
  • packages/message-parser/tests/abuse.test.ts
  • packages/message-parser/tests/tasks.test.ts
  • packages/message-parser/tests/spoilerBlock.test.ts
  • packages/message-parser/tests/strikethrough.test.ts
  • packages/message-parser/tests/emphasis.test.ts
  • packages/message-parser/tests/inlineCodeStrike.test.ts
  • packages/message-parser/tests/url.test.ts
  • packages/message-parser/tests/email.test.ts
  • packages/message-parser/tests/escaped.test.ts
  • packages/message-parser/tests/lineBreak.test.ts
  • packages/message-parser/tests/unorderedList.test.ts
  • packages/message-parser/tests/color.test.ts
  • packages/message-parser/tests/spoiler.test.ts
  • packages/message-parser/tests/phoneNumber.test.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to **/*.{ts,tsx,js} : Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests

Applied to files:

  • packages/message-parser/tests/strongEmphasis.test.ts
  • packages/message-parser/tests/heading.test.ts
  • packages/message-parser/tests/blockquotes.test.ts
  • packages/message-parser/tests/any.test.ts
  • packages/message-parser/tests/link.test.ts
  • packages/message-parser/tests/orderedList.test.ts
  • packages/message-parser/tests/timestamp.test.ts
  • packages/message-parser/tests/inlineCode.test.ts
  • packages/message-parser/tests/codeFence.test.ts
  • packages/message-parser/tests/tasks.test.ts
  • packages/message-parser/tests/strikethrough.test.ts
  • packages/message-parser/tests/emphasis.test.ts
  • packages/message-parser/tests/inlineCodeStrike.test.ts
  • packages/message-parser/tests/url.test.ts
  • packages/message-parser/tests/escaped.test.ts
  • packages/message-parser/tests/lineBreak.test.ts
  • packages/message-parser/tests/helpers.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Maintain test isolation between test cases in Playwright tests

Applied to files:

  • packages/message-parser/tests/strongEmphasis.test.ts
  • packages/message-parser/tests/blockquotes.test.ts
  • packages/message-parser/tests/any.test.ts
  • packages/message-parser/tests/link.test.ts
  • packages/message-parser/tests/image.test.ts
  • packages/message-parser/tests/orderedList.test.ts
  • packages/message-parser/tests/emphasisWithEmoticons.test.ts
  • packages/message-parser/tests/mention.test.ts
  • packages/message-parser/tests/timestamp.test.ts
  • packages/message-parser/tests/inlineCode.test.ts
  • packages/message-parser/tests/codeFence.test.ts
  • packages/message-parser/tests/abuse.test.ts
  • packages/message-parser/tests/tasks.test.ts
  • packages/message-parser/tests/spoilerBlock.test.ts
  • packages/message-parser/tests/strikethrough.test.ts
  • packages/message-parser/tests/emphasis.test.ts
  • packages/message-parser/tests/inlineCodeStrike.test.ts
  • packages/message-parser/tests/katex.test.ts
  • packages/message-parser/tests/email.test.ts
  • packages/message-parser/tests/escaped.test.ts
  • packages/message-parser/tests/lineBreak.test.ts
  • packages/message-parser/tests/unorderedList.test.ts
  • packages/message-parser/tests/color.test.ts
  • packages/message-parser/tests/spoiler.test.ts
  • packages/message-parser/tests/emoji.test.ts
  • packages/message-parser/tests/phoneNumber.test.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Group related tests in the same file

Applied to files:

  • packages/message-parser/tests/strongEmphasis.test.ts
  • packages/message-parser/tests/heading.test.ts
  • packages/message-parser/tests/blockquotes.test.ts
  • packages/message-parser/tests/any.test.ts
  • packages/message-parser/tests/link.test.ts
  • packages/message-parser/tests/image.test.ts
  • packages/message-parser/tests/orderedList.test.ts
  • packages/message-parser/tests/emphasisWithEmoticons.test.ts
  • packages/message-parser/tests/mention.test.ts
  • packages/message-parser/tests/timestamp.test.ts
  • packages/message-parser/tests/inlineCode.test.ts
  • packages/message-parser/tests/codeFence.test.ts
  • packages/message-parser/tests/abuse.test.ts
  • packages/message-parser/tests/tasks.test.ts
  • packages/message-parser/tests/spoilerBlock.test.ts
  • packages/message-parser/tests/strikethrough.test.ts
  • packages/message-parser/tests/emphasis.test.ts
  • packages/message-parser/tests/inlineCodeStrike.test.ts
  • packages/message-parser/tests/katex.test.ts
  • packages/message-parser/tests/email.test.ts
  • packages/message-parser/tests/lineBreak.test.ts
  • packages/message-parser/tests/unorderedList.test.ts
  • packages/message-parser/tests/color.test.ts
  • packages/message-parser/tests/spoiler.test.ts
  • packages/message-parser/tests/emoji.test.ts
  • packages/message-parser/tests/phoneNumber.test.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.{ts,spec.ts} : Follow Page Object Model pattern consistently in Playwright tests

Applied to files:

  • packages/message-parser/tests/strongEmphasis.test.ts
  • packages/message-parser/tests/any.test.ts
  • packages/message-parser/tests/link.test.ts
  • packages/message-parser/tests/inlineCode.test.ts
  • packages/message-parser/tests/abuse.test.ts
  • packages/message-parser/tests/tasks.test.ts
  • packages/message-parser/tests/url.test.ts
  • packages/message-parser/tests/lineBreak.test.ts
  • packages/message-parser/tests/color.test.ts
📚 Learning: 2025-11-19T18:20:07.720Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 37419
File: packages/i18n/src/locales/en.i18n.json:918-921
Timestamp: 2025-11-19T18:20:07.720Z
Learning: Repo: RocketChat/Rocket.Chat — i18n/formatting
Learning: This repository uses a custom message formatting parser in UI blocks/messages; do not assume standard Markdown rules. For keys like Call_ended_bold, Call_not_answered_bold, Call_failed_bold, and Call_transferred_bold in packages/i18n/src/locales/en.i18n.json, retain the existing single-asterisk emphasis unless maintainers request otherwise.

Applied to files:

  • packages/message-parser/tests/strongEmphasis.test.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : All test files must be created in `apps/meteor/tests/e2e/` directory

Applied to files:

  • packages/message-parser/tests/heading.test.ts
  • packages/message-parser/tests/orderedList.test.ts
  • packages/message-parser/tests/codeFence.test.ts
  • packages/message-parser/tests/tasks.test.ts
  • packages/message-parser/tests/inlineCodeStrike.test.ts
  • packages/message-parser/tests/email.test.ts
  • packages/message-parser/tests/lineBreak.test.ts
  • packages/message-parser/tests/unorderedList.test.ts
  • packages/message-parser/tests/emoji.test.ts
📚 Learning: 2025-11-24T17:08:26.531Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/test-cases.mdc:0-0
Timestamp: 2025-11-24T17:08:26.531Z
Learning: Applies to **/*test-case*.md : Write test cases in Markdown format following the standardized template with ALL necessary components: Title, Description, Preconditions, Type, Steps, and Expected Result

Applied to files:

  • packages/message-parser/tests/heading.test.ts
  • packages/message-parser/tests/orderedList.test.ts
  • packages/message-parser/tests/unorderedList.test.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/page-objects/**/*.ts : Utilize existing page objects pattern from `apps/meteor/tests/e2e/page-objects/`

Applied to files:

  • packages/message-parser/tests/any.test.ts
  • packages/message-parser/tests/link.test.ts
  • packages/message-parser/tests/mention.test.ts
  • packages/message-parser/tests/codeFence.test.ts
  • packages/message-parser/tests/tasks.test.ts
  • packages/message-parser/tests/emphasis.test.ts
  • packages/message-parser/tests/email.test.ts
  • packages/message-parser/tests/color.test.ts
  • packages/message-parser/tests/phoneNumber.test.ts
  • packages/message-parser/tests/helpers.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to **/*.spec.ts : Use descriptive test names that clearly communicate expected behavior in Playwright tests

Applied to files:

  • packages/message-parser/tests/any.test.ts
  • packages/message-parser/tests/timestamp.test.ts
  • packages/message-parser/tests/abuse.test.ts
  • packages/message-parser/tests/strikethrough.test.ts
  • packages/message-parser/tests/url.test.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Prefer web-first assertions (`toBeVisible`, `toHaveText`, etc.) in Playwright tests

Applied to files:

  • packages/message-parser/tests/timestamp.test.ts
  • packages/message-parser/tests/url.test.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use `test.beforeAll()` and `test.afterAll()` for setup/teardown in Playwright tests

Applied to files:

  • packages/message-parser/tests/timestamp.test.ts
📚 Learning: 2026-02-24T19:36:55.089Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 38493
File: apps/meteor/tests/e2e/page-objects/fragments/home-content.ts:60-82
Timestamp: 2026-02-24T19:36:55.089Z
Learning: In RocketChat/Rocket.Chat e2e tests (apps/meteor/tests/e2e/page-objects/fragments/home-content.ts), thread message preview listitems do not have aria-roledescription="message", so lastThreadMessagePreview locator cannot be scoped to messageListItems (which filters for aria-roledescription="message"). It should remain scoped to page.getByRole('listitem') or mainMessageList.getByRole('listitem').

Applied to files:

  • packages/message-parser/tests/spoilerBlock.test.ts
  • packages/message-parser/tests/spoiler.test.ts
📚 Learning: 2025-11-24T17:08:26.531Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/test-cases.mdc:0-0
Timestamp: 2025-11-24T17:08:26.531Z
Learning: Applies to **/*test-case*.md : List specific preconditions required before test case execution

Applied to files:

  • packages/message-parser/tests/unorderedList.test.ts
🧬 Code graph analysis (1)
packages/message-parser/tests/url.test.ts (2)
packages/message-parser/tests/helpers.ts (3)
  • paragraph (6-6)
  • link (39-42)
  • plain (34-34)
packages/message-parser/src/utils.ts (3)
  • paragraph (27-27)
  • link (78-81)
  • plain (65-65)
🔇 Additional comments (32)
packages/message-parser/tests/helpers.ts (1)

1-102: Solid test-helper extraction with broad token coverage.

This helper module cleanly centralizes test AST construction and removes coupling to production utility functions, which is exactly the right direction for regression-safe parser tests.

packages/message-parser/tests/abuse.test.ts (1)

2-2: Correct helper import migration.

Using ./helpers here keeps expected AST construction independent from production utility internals.

packages/message-parser/tests/tasks.test.ts (1)

2-2: Nice decoupling in task-parser tests.

The switch to ./helpers preserves test intent while removing oracle coupling to production helper code.

packages/message-parser/tests/escaped.test.ts (1)

2-2: Import refactor looks good.

Escaped-sequence expectations now rely on local test helpers instead of production utilities, which improves regression detection quality.

packages/message-parser/tests/katex.test.ts (1)

2-2: Good helper-source switch for KaTeX tests.

This keeps parser expectations explicit and independent from production-side utility behavior.

packages/message-parser/tests/heading.test.ts (1)

2-2: Heading tests now correctly use local builders.

The import move to ./helpers is clean and maintains expected-output clarity.

packages/message-parser/tests/blockquotes.test.ts (1)

2-2: Blockquote test import update is correct.

Switching to ./helpers keeps expected AST fixtures test-owned and reduces regression masking risk.

packages/message-parser/tests/phoneNumber.test.ts (1)

2-2: Phone-number test migration to local helpers is good.

Expected token construction is now test-local, which better protects against helper-induced false positives.

packages/message-parser/tests/any.test.ts (1)

1-10: LGTM!

Import source correctly updated to use local test helpers, and test logic remains unchanged. This aligns with the PR objective of decoupling tests from production code.

packages/message-parser/tests/spoilerBlock.test.ts (1)

1-30: LGTM!

Import source correctly updated to use local test helpers. The spoiler block test cases remain unchanged and provide good coverage for various spoiler scenarios.

packages/message-parser/tests/emoji.test.ts (1)

1-62: LGTM!

Import source correctly updated to use local test helpers. Comprehensive test coverage for both shortcode and unicode emoji parsing remains intact.

packages/message-parser/tests/emphasis.test.ts (1)

1-130: LGTM!

Import source correctly updated to use local test helpers. The extensive emphasis parsing test suite remains unchanged with comprehensive edge case coverage.

packages/message-parser/tests/emphasisWithEmoticons.test.ts (1)

1-58: LGTM!

Import source correctly updated to use local test helpers. Test cases for emphasis with emoticons interactions remain unchanged.

packages/message-parser/tests/inlineCodeStrike.test.ts (1)

1-14: LGTM!

Import source correctly updated to use local test helpers. Test cases for inline code with strikethrough combinations remain unchanged.

packages/message-parser/tests/emoticons.test.ts (1)

1-70: LGTM!

Import source correctly updated to use local test helpers. Comprehensive emoticon parsing test suite remains unchanged with good coverage of rendering and non-rendering scenarios.

packages/message-parser/tests/color.test.ts (1)

1-18: LGTM!

Import source correctly updated to use local test helpers. Color parsing tests remain unchanged with good coverage of valid and invalid hex color formats.

packages/message-parser/tests/orderedList.test.ts (1)

2-2: Import migration is clean and aligned with the decoupling goal.

Using ./helpers here keeps test expectations independent from production utility behavior.

packages/message-parser/tests/strikethrough.test.ts (1)

2-2: Good helper import swap for test isolation.

This change keeps the strikethrough tests independent from production helper internals.

packages/message-parser/tests/mention.test.ts (1)

2-2: Nice update to local test helpers.

The import change supports explicit, test-owned expected structures without altering behavior coverage.

packages/message-parser/tests/codeFence.test.ts (1)

2-2: Import adjustment looks correct.

Switching to ./helpers keeps this suite consistent with the new test-only builder pattern.

packages/message-parser/tests/inlineCode.test.ts (1)

2-2: Clean helper source migration.

This keeps inline-code expectations test-local and avoids coupling with production utility implementations.

packages/message-parser/tests/lineBreak.test.ts (1)

2-2: Looks good—import now points to the test helper module.

This is a solid decoupling step with no behavior drift in the suite.

packages/message-parser/tests/email.test.ts (1)

2-2: Good import-path update for helper isolation.

The test continues to assert explicit expected nodes while removing dependency on production helpers.

packages/message-parser/tests/image.test.ts (1)

2-2: Change is correct and consistent with the suite-wide refactor.

Importing test helpers from ./helpers improves separation between tests and production utilities.

packages/message-parser/tests/strongEmphasis.test.ts (1)

1-2: LGTM!

The import source correctly updated to use the local test helpers module. This change aligns with the PR objective of decoupling tests from production utilities.

packages/message-parser/tests/spoiler.test.ts (1)

1-2: LGTM!

Import correctly updated to use local test helpers while preserving all test cases and their expectations.

packages/message-parser/tests/link.test.ts (1)

1-2: LGTM!

Import correctly updated. The comprehensive test coverage for link parsing remains intact with the new local helpers.

packages/message-parser/tests/unorderedList.test.ts (1)

1-2: LGTM!

Import correctly updated to use local test helpers.

packages/message-parser/tests/timestamp.test.ts (2)

3-18: LGTM!

Defining helpers inline in this file is appropriate since timestampNode has a unique structure (with fallback property) that differs from other token helpers. This approach keeps timestamp-specific test logic self-contained.


53-71: LGTM!

Good use of Jest fake timers to test relative hour timestamp parsing with a deterministic system time. The beforeAll/afterAll hooks properly manage timer state.

packages/message-parser/tests/url.test.ts (2)

2-3: LGTM!

Good separation of concerns: test helpers imported from ./helpers for building expected outputs, while autoLink is retained from production code specifically for testing its dedicated behavior (lines 153-181). This aligns with the PR's rationale.


137-145: LGTM!

Custom domain tests correctly updated to use explicit link() expectations instead of oracle-derived outputs, ensuring tests will detect regressions if the underlying helper behavior changes.

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.

1 issue found across 30 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/message-parser/tests/timestamp.test.ts">

<violation number="1" location="packages/message-parser/tests/timestamp.test.ts:3">
P2: Duplicate AST builder helpers are redefined inline instead of importing the shared test helpers, increasing maintenance overhead and contradicting the test-helper reuse guideline.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

import { parse } from '../src';
import { bold, paragraph, plain, strike, timestamp, timestampFromHours } from '../src/utils';

const plain = (value: string) => ({ type: 'PLAIN_TEXT' as const, value });
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot Feb 26, 2026

Choose a reason for hiding this comment

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

P2: Duplicate AST builder helpers are redefined inline instead of importing the shared test helpers, increasing maintenance overhead and contradicting the test-helper reuse guideline.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/message-parser/tests/timestamp.test.ts, line 3:

<comment>Duplicate AST builder helpers are redefined inline instead of importing the shared test helpers, increasing maintenance overhead and contradicting the test-helper reuse guideline.</comment>

<file context>
@@ -1,10 +1,26 @@
 import { parse } from '../src';
-import { bold, paragraph, plain, strike, timestamp, timestampFromHours } from '../src/utils';
+
+const plain = (value: string) => ({ type: 'PLAIN_TEXT' as const, value });
+
+const paragraph = (value: Array<Record<string, unknown>>) => ({ type: 'PARAGRAPH' as const, value });
</file context>
Fix with Cubic

Copy link
Copy Markdown
Contributor

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

🧹 Nitpick comments (1)
packages/message-parser/tests/timestamp.test.ts (1)

3-18: Prefer shared test builders from tests/helpers.ts instead of local duplicates.

This file redefines factories that now exist in packages/message-parser/tests/helpers.ts. Importing shared test builders keeps AST helper semantics centralized and avoids drift across parser tests.

Proposed refactor
 import { parse } from '../src';
+import { bold, paragraph, plain, strike, timestampNode } from './helpers';

-const plain = (value: string) => ({ type: 'PLAIN_TEXT' as const, value });
-
-const paragraph = (value: Array<Record<string, unknown>>) => ({ type: 'PARAGRAPH' as const, value });
-
-const bold = (value: Array<Record<string, unknown>>) => ({ type: 'BOLD' as const, value });
-
-const strike = (value: Array<Record<string, unknown>>) => ({ type: 'STRIKE' as const, value });
-
-const timestampNode = (value: string, format: 't' | 'T' | 'd' | 'D' | 'f' | 'F' | 'R' = 't') => ({
-	type: 'TIMESTAMP' as const,
-	value: {
-		timestamp: value,
-		format,
-	},
-	fallback: plain(`<t:${value}:${format}>`),
-});
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/message-parser/tests/timestamp.test.ts` around lines 3 - 18, Replace
the local factory functions plain, paragraph, bold, strike and timestampNode
with the shared test builders from packages/message-parser/tests/helpers.ts:
remove the local const declarations for plain, paragraph, bold, strike and
timestampNode and add an import for the corresponding helper builders (the
exported names for those builders in helpers.ts) at the top of the test file;
ensure the test uses the helpers' timestamp builder (with the same signature for
timestamp and format) and update any calls to match the helpers' exported names
if they differ.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/message-parser/tests/timestamp.test.ts`:
- Around line 3-18: Replace the local factory functions plain, paragraph, bold,
strike and timestampNode with the shared test builders from
packages/message-parser/tests/helpers.ts: remove the local const declarations
for plain, paragraph, bold, strike and timestampNode and add an import for the
corresponding helper builders (the exported names for those builders in
helpers.ts) at the top of the test file; ensure the test uses the helpers'
timestamp builder (with the same signature for timestamp and format) and update
any calls to match the helpers' exported names if they differ.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1c0ca6f and e85dc5d.

📒 Files selected for processing (1)
  • packages/message-parser/tests/timestamp.test.ts
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: CodeQL-Build
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation

Files:

  • packages/message-parser/tests/timestamp.test.ts
🧠 Learnings (11)
📓 Common learnings
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Utilize Playwright fixtures (`test`, `page`, `expect`) for consistency in test files
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Group related tests in the same file
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Ensure tests run reliably in parallel without shared state conflicts
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/page-objects/**/*.ts : Utilize existing page objects pattern from `apps/meteor/tests/e2e/page-objects/`
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use `expect` matchers for assertions (`toEqual`, `toContain`, `toBeTruthy`, `toHaveLength`, etc.) instead of `assert` statements in Playwright tests
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use `test.beforeAll()` and `test.afterAll()` for setup/teardown in Playwright tests
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use `test.step()` for complex test scenarios to improve organization in Playwright tests
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Maintain test isolation between test cases in Playwright tests
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.{ts,spec.ts} : Follow Page Object Model pattern consistently in Playwright tests
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.{ts,spec.ts} : Store commonly used locators in variables/constants for reuse
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Utilize Playwright fixtures (`test`, `page`, `expect`) for consistency in test files

Applied to files:

  • packages/message-parser/tests/timestamp.test.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Ensure tests run reliably in parallel without shared state conflicts

Applied to files:

  • packages/message-parser/tests/timestamp.test.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use `test.step()` for complex test scenarios to improve organization in Playwright tests

Applied to files:

  • packages/message-parser/tests/timestamp.test.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use `expect` matchers for assertions (`toEqual`, `toContain`, `toBeTruthy`, `toHaveLength`, etc.) instead of `assert` statements in Playwright tests

Applied to files:

  • packages/message-parser/tests/timestamp.test.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Maintain test isolation between test cases in Playwright tests

Applied to files:

  • packages/message-parser/tests/timestamp.test.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Group related tests in the same file

Applied to files:

  • packages/message-parser/tests/timestamp.test.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to **/*.spec.ts : Use descriptive test names that clearly communicate expected behavior in Playwright tests

Applied to files:

  • packages/message-parser/tests/timestamp.test.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use `test.beforeAll()` and `test.afterAll()` for setup/teardown in Playwright tests

Applied to files:

  • packages/message-parser/tests/timestamp.test.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to **/*.{ts,tsx,js} : Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests

Applied to files:

  • packages/message-parser/tests/timestamp.test.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Prefer web-first assertions (`toBeVisible`, `toHaveText`, etc.) in Playwright tests

Applied to files:

  • packages/message-parser/tests/timestamp.test.ts
🔇 Additional comments (2)
packages/message-parser/tests/timestamp.test.ts (2)

51-59: Nice isolation in the relative-hour suite.

Using fake timers with explicit setup/teardown here is clean and keeps the new relative parsing cases deterministic.

Also applies to: 61-69


24-25: Acknowledge codebase convention before changing matchers.

While toEqual provides stricter equality than toMatchObject, all 28 test files in packages/message-parser/tests/ consistently use toMatchObject. Changing only this file creates inconsistency. If this change is part of a broader refactor to migrate the entire package to stricter matchers, expand the scope to cover all test files. Otherwise, provide evidence that the parser output contains problematic extra properties that are being masked by toMatchObject.

Likely an incorrect or invalid review comment.

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.71%. Comparing base (afaabea) to head (e85dc5d).
⚠️ Report is 60 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #39086      +/-   ##
===========================================
+ Coverage    70.66%   70.71%   +0.04%     
===========================================
  Files         3191     3192       +1     
  Lines       112965   113064      +99     
  Branches     20451    20508      +57     
===========================================
+ Hits         79829    79951     +122     
+ Misses       31088    31068      -20     
+ Partials      2048     2045       -3     
Flag Coverage Δ
e2e 60.35% <ø> (-0.04%) ⬇️
e2e-api 47.79% <ø> (-0.02%) ⬇️
unit 71.37% <100.00%> (+0.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ggazzo ggazzo changed the title fix(message-parser): decouple parser tests from production helpers test(message-parser): decouple parser tests from production helpers Feb 26, 2026
@ggazzo ggazzo added this to the 8.3.0 milestone Feb 26, 2026
@ggazzo ggazzo added the stat: QA assured Means it has been tested and approved by a company insider label Feb 26, 2026
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Feb 26, 2026
@dionisio-bot dionisio-bot bot enabled auto-merge February 26, 2026 12:54
@ggazzo ggazzo disabled auto-merge February 26, 2026 16:41
@ggazzo ggazzo merged commit 2affa17 into RocketChat:develop Feb 26, 2026
80 of 82 checks passed
@ggazzo
Copy link
Copy Markdown
Member

ggazzo commented Feb 26, 2026

/jira ARCH-1935

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge type: chore

Projects

None yet

3 participants