Skip to content

Conversation

@KevLehman
Copy link
Member

@KevLehman KevLehman commented Jan 21, 2026

Proposed changes (including videos or screenshots)

Issue(s)

Steps to test or reproduce

Further comments

Summary by CodeRabbit

  • Tests

    • Enhanced test coverage for livechat contact management workflows, including visitor mapping, conflict resolution, and custom field validation.
  • Chores

    • Updated test configuration and fixtures.

✏️ Tip: You can customize this high-level summary in your review settings.

@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Jan 21, 2026

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

  • This PR is targeting the wrong base branch. It should target 8.2.0, but it targets 8.1.0

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link

changeset-bot bot commented Jan 21, 2026

⚠️ No Changeset found

Latest commit: 44be59e

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
Contributor

coderabbitai bot commented Jan 21, 2026

Walkthrough

This PR updates Mocha test configuration and refactors multiple test files for Livechat contact functionality, including test fixture enhancements with lastChat fields, API signature adjustments for customFields handling, and test expectation updates.

Changes

Cohort / File(s) Changes
Mocha Configuration
apps/meteor/.mocharc.js
Added spec glob pattern app/livechat/server/lib/**/*.spec.ts to enable test discovery for livechat contact tests
Livechat Contact Tests
apps/meteor/app/livechat/server/lib/contacts/mapVisitorToContact.spec.ts, resolveContactConflicts.spec.ts, updateContact.spec.ts, validateCustomFields.spec.ts
Enhanced test fixtures with lastChat fields (id and timestamp); refactored customFields API to accept composite objects rather than individual fields; simplified test expectations by removing counter increment assertions and return value checks; changed option parameter from ignoreValidationErrors to ignoreAdditionalFields; updated getAllowedCustomFields stub to resolve consistently to empty array; altered test iteration from for-of loops to forEach pattern

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

stat: ready to merge, stat: QA assured

Suggested reviewers

  • aleksandernsilva
  • ggazzo
  • lucas-a-pelegrino

Poem

🐰 Hops through specs with glee,
Contact fields now lastChat to see,
CustomFields nested tight,
Tests adjusted right,
Livechat blooms on git-ee! 🌸

🚥 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 PR title 'test: Fix ignored unit tests' is specific and directly related to the main changeset, which fixes and updates multiple test files (.spec.ts files) across the livechat module.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch test/fix-hidden-test

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.

@codecov
Copy link

codecov bot commented Jan 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.82%. Comparing base (25271b2) to head (44be59e).
⚠️ Report is 2 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #38288      +/-   ##
===========================================
+ Coverage    70.75%   70.82%   +0.06%     
===========================================
  Files         3142     3158      +16     
  Lines       108926   109363     +437     
  Branches     19581    19682     +101     
===========================================
+ Hits         77072    77451     +379     
- Misses       29857    29876      +19     
- Partials      1997     2036      +39     
Flag Coverage Δ
e2e 60.34% <ø> (+0.02%) ⬆️
e2e-api 49.09% <ø> (+0.96%) ⬆️
unit 71.93% <100.00%> (+0.06%) ⬆️

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.

@KevLehman KevLehman marked this pull request as ready for review January 21, 2026 19:24
@KevLehman KevLehman requested a review from a team as a code owner January 21, 2026 19:24
@KevLehman KevLehman added this to the 8.2.0 milestone Jan 21, 2026
@github-actions
Copy link
Contributor

📦 Docker Image Size Report

➡️ Changes

Service Current Baseline Change Percent
sum of all images 0B 0B 0B
account-service 0B 0B 0B
authorization-service 0B 0B 0B
ddp-streamer-service 0B 0B 0B
omnichannel-transcript-service 0B 0B 0B
presence-service 0B 0B 0B
queue-worker-service 0B 0B 0B
rocketchat 0B 0B 0B

📊 Historical Trend

---
config:
  theme: "dark"
  xyChart:
    width: 900
    height: 400
---
xychart
  title "Image Size Evolution by Service (Last 30 Days + This PR)"
  x-axis ["11/18 22:53", "11/19 23:02", "11/21 16:49", "11/24 17:34", "11/27 22:32", "11/28 19:05", "12/01 23:01", "12/02 21:57", "12/03 21:00", "12/04 18:17", "12/05 21:56", "12/08 20:15", "12/09 22:17", "12/10 23:26", "12/11 21:56", "12/12 22:45", "12/13 01:34", "12/15 22:31", "12/16 22:18", "12/17 21:04", "12/18 23:12", "12/19 23:27", "12/20 21:03", "12/22 18:54", "12/23 16:16", "12/24 19:38", "12/25 17:51", "12/26 13:18", "12/29 19:01", "12/30 20:52", "01/21 19:26 (PR)"]
  y-axis "Size (GB)" 0 --> 0.5
  line "account-service" [0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.00]
  line "authorization-service" [0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.00]
  line "ddp-streamer-service" [0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.00]
  line "omnichannel-transcript-service" [0.14, 0.14, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.00]
  line "presence-service" [0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.00]
  line "queue-worker-service" [0.14, 0.14, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.00]
  line "rocketchat" [0.35, 0.35, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.00]
Loading

Statistics (last 30 days):

  • 📊 Average: 1.5GiB
  • ⬇️ Minimum: 1.4GiB
  • ⬆️ Maximum: 1.6GiB
  • 🎯 Current PR: 0B
ℹ️ About this report

This report compares Docker image sizes from this build against the develop baseline.

  • Tag: pr-38288
  • Baseline: develop
  • Timestamp: 2026-01-21 19:26:52 UTC
  • Historical data points: 30

Updated: Wed, 21 Jan 2026 19:26:52 GMT

Copy link
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: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (4)
apps/meteor/app/livechat/server/lib/contacts/validateCustomFields.spec.ts (1)

54-61: Test description doesn't match the option name used.

The test description on line 54 says "ignoreValidationErrors option is provided" but the code on line 58 uses ignoreAdditionalFields. This inconsistency could cause confusion when debugging test failures.

Suggested fix
-	it('should not throw an error if a extra custom field is passed, but the ignoreValidationErrors option is provided', () => {
+	it('should not throw an error if an extra custom field is passed, but the ignoreAdditionalFields option is provided', () => {
apps/meteor/app/livechat/server/lib/contacts/resolveContactConflicts.spec.ts (3)

86-121: Nested it() blocks will never execute.

The inner it() block on line 87 is nested inside the outer it() on line 86. Mocha does not support this pattern - nested it() calls are silently ignored. This test will appear to pass but never actually run the assertions.

Suggested fix: flatten the test structure
-	it('should wipe conflicts if wipeConflicts = true', async () => {
-		it('should update the contact with the resolved name', async () => {
+	it('should wipe conflicts if wipeConflicts = true', async () => {
			modelsMock.LivechatContacts.findOneEnabledById.resolves({
				// ... rest of test setup
			});
			// ... assertions
-		});
	});

Remove the inner it() wrapper and keep only the outer test block with its assertions.


123-158: Duplicate test description and nested it() pattern.

This test has the same issues as lines 86-121:

  1. The description duplicates "should wipe conflicts if wipeConflicts = true" but tests with wipeConflicts: false (line 142)
  2. Contains a nested it() block that will never execute

The test description should reflect the actual scenario being tested (e.g., "should preserve remaining conflicts if wipeConflicts = false").


160-179: Fix parameter key: change customField to customFields on lines 162 and 176.

The function signature uses customFields (plural). Lines 40 and 76 correctly pass customFields, but lines 162 and 176 incorrectly use customField (singular). This should be customFields: { customField: 'newValue' } to match the API.

Copy link
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 5 files

@KevLehman KevLehman added the stat: QA assured Means it has been tested and approved by a company insider label Jan 22, 2026
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Jan 22, 2026
@ggazzo ggazzo changed the title test: Fix hidden unit tests test: Fix ignored unit tests Jan 22, 2026
@ggazzo ggazzo merged commit cb094ce into develop Jan 22, 2026
49 checks passed
@ggazzo ggazzo deleted the test/fix-hidden-test branch January 22, 2026 17:18
Kaustubh1204 pushed a commit to Kaustubh1204/Rocket.Chat that referenced this pull request Jan 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants