Skip to content

test: consolidate message/snapshot builders into shared support module - #18

Merged
ForeverInLaw merged 2 commits into
mainfrom
simplify/test-consolidate
Sep 22, 2026
Merged

ForeverInLaw merged 2 commits into
mainfrom
simplify/test-consolidate

Conversation

@ForeverInLaw

@ForeverInLaw ForeverInLaw commented Sep 21, 2026 •

Copy link
Copy Markdown

User description

Problem

Thirteen test files carried private copies of the same scaffolding: null-defaulted ChatMessage/GroupMessage/ChannelMessage builders and SessionSnapshot/GroupSnapshot/ChannelSnapshot constructors, written out per file.

Change

One shared test/support/message_builders.dart (TestMessages, TestSnapshots, TestCalls) owns the builders; each test file imports it and keeps at most a thin named-arg shim where its defaults differed. Net −346 lines across the 13 files; the shared file amortizes over every future test.

No test names, assertions, or coverage changed.

Verification

  • All 838 widget/unit tests pass (each rewritten file also passed its own scoped run during the consolidation)
  • flutter analyze clean, dart format lib test clean

Stack: PR 5/6 (on #17).


CodeAnt-AI Description

Centralize conversation and voice-call test data setup

What Changed

  • Added shared builders for direct messages, group messages, channel messages, conversation snapshots, and active calls
  • Replaced duplicated setup code across conversation and voice-call tests while preserving each test’s existing defaults and overrides
  • Kept active-call fixtures valid so call lifecycle tests continue to exercise automatic call attachment successfully
  • Test assertions and application behavior remain unchanged

Impact

✅ Shorter test setup
✅ Consistent conversation fixtures
✅ Reliable voice-call lifecycle tests

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

@codeant-ai

codeant-ai Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Incremental review completed d231573 Sep 22, 2026 · 01:33 01:34
✅ Reviewed your PR d790a78 Sep 21, 2026 · 23:04 23:09

@codeant-ai

codeant-ai Bot commented Sep 21, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@codeant-ai codeant-ai Bot added the size:L This PR changes 100-499 lines, ignoring generated files label Sep 21, 2026
@codeant-ai

codeant-ai Bot commented Sep 21, 2026

Copy link
Copy Markdown

CodeAnt Nitpicks

2 code suggestions

1. Omitting creatorFingerprint uses the shared device fingerprint default, so unrelated admin, count, and invite tests render the encryption lock and can miss header layout regressions.

Possible bug · test/features/conversation/group_screen_header_test.dart:43-48


2. Active-call fixtures default startedAtMs to the Unix epoch, so CallOverlay displays an enormous elapsed duration instead of the call's actual start time.

Logic error · test/support/message_builders.dart:256

@ForeverInLaw
ForeverInLaw force-pushed the simplify/test-consolidate branch from d790a78 to b3f4eeb Compare September 21, 2026 23:21
@ForeverInLaw
ForeverInLaw force-pushed the simplify/ui-simplify branch 2 times, most recently from 7a12881 to 2178b6d Compare September 21, 2026 23:42
@ForeverInLaw
ForeverInLaw force-pushed the simplify/test-consolidate branch from b3f4eeb to 3b8cddb Compare September 21, 2026 23:42
Thirteen test files carried their own private _msg/_snapshot builders
- the same ChatMessage/GroupMessage/ChannelMessage and SessionSnapshot/
GroupSnapshot/ChannelSnapshot null-defaulted boilerplate written out
per file. One shared module (test/support/message_builders.dart,
TestMessages + TestSnapshots + TestCalls) now owns them; each test file
imports it and keeps at most a thin named-arg shim where its defaults
differed.

No test names, assertions, or coverage changed. Net -346 lines across
the 13 files; the shared file amortizes across every future test.
flutter analyze clean, all 838 tests pass.
@ForeverInLaw
ForeverInLaw force-pushed the simplify/test-consolidate branch from 3b8cddb to d231573 Compare September 22, 2026 01:33
@ForeverInLaw
ForeverInLaw changed the base branch from simplify/ui-simplify to main September 22, 2026 01:55
@ForeverInLaw
ForeverInLaw merged commit 8646838 into main Sep 22, 2026
13 of 20 checks passed
@ForeverInLaw
ForeverInLaw deleted the simplify/test-consolidate branch September 22, 2026 01:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant