Skip to content

test: cover isMessageSequential grouping rules - #1374

Open
ishan-one8 wants to merge 1 commit into
RocketChat:developfrom
ishan-one8:test/cover-is-message-sequential
Open

ishan-one8 wants to merge 1 commit into
RocketChat:developfrom
ishan-one8:test/cover-is-message-sequential

Conversation

@ishan-one8

Copy link
Copy Markdown

Cover isMessageSequential grouping rules with unit tests

Acceptance Criteria fulfillment

  • Adds packages/layout_editor/src/lib/isMessageSequential.test.js, covering every branch of the grouping rules
  • Test-only — no source changes (git diff on the source is empty)
  • Follows the existing conventions in that folder: node:test, node:assert/strict, flat test() calls
  • Full layout_editor suite passes locally — 25/25 (17 existing + 8 new)

Fixes #1373

Video/Screenshots

Not applicable — no visible change, test file only.

PR Test Details

yarn test in packages/layout_editor (node --test src/lib/*.test.js) → 25 pass, 0 fail.

Behaviours now covered:

  • no previous message
  • same user inside the grouping range (the actual grouping case)
  • different users
  • a gap wider than the grouping range
  • system messages (t set on either message)
  • groupable: false
  • differing alias
  • a day boundary inside the grouping range

These are not tests that pass when the behaviour is broken. Removing the day-boundary guard from the source (return isTimeDiffSmall && !isMessageNewDay → return isTimeDiffSmall) makes the last one fail:

✖ does not group across a day boundary even inside the grouping range
  AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
  true !== false

The source was reverted afterwards — this PR touches no source file.

Note: the day-boundary test uses local-time timestamps rather than UTC Z strings on purpose, since isSameDay compares local calendar days.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: isMessageSequential in layout_editor has no coverage

1 participant