Skip to content

fix: stabilize all test suites after v14 breaking changes#3039

Open
oliverlaz wants to merge 2 commits intomasterfrom
fix/stabilize-v14-tests
Open

fix: stabilize all test suites after v14 breaking changes#3039
oliverlaz wants to merge 2 commits intomasterfrom
fix/stabilize-v14-tests

Conversation

@oliverlaz
Copy link
Member

@oliverlaz oliverlaz commented Mar 21, 2026

Summary

  • Fix all 67 failing test suites (506 tests) caused by v14 breaking changes
  • Resolve circular dependency chains in MessageComposer barrel imports
  • Add missing React imports and restore lost Preview prop on ChannelListItem
  • Add JSDoc warning to useDebouncedTypingActive about user?.id requirement
  • Upgrade EventEmitterMock and MediaRecorderMock to support realistic event dispatch

Test plan

  • yarn jest --watchAll=false --no-coverage --testPathPattern="src/" — 142/142 suites pass, 1977/1977 tests green, 0 skipped
  • yarn lint-fix passes (all lint errors resolved)
  • yarn types — verify TypeScript still compiles
  • yarn build — verify production build

Categories of test fixes

Category Suites Changes
Missing DialogManager context ~10 Added <Chat> or <DialogManagerProvider> wrappers
Avatar prop renames ~15 imageimageUrl, nameuserName, added size
Component renames ~10 ReactionsListMessageReactions, MessageDeletedMessageDeletedBubble, etc.
Removed context fields ~8 Removed editing, updated handleDelete signature, cooldown API migration
Stale snapshots ~25 Regenerated .snap files, replaced inline snapshots with structural assertions
Missing mocks ~10 Added useChatViewContext, useThreadContext, deleteDraft mocks
Behavioral changes ~5 Mobile nav viewport check, action renames, mention UI changes
AudioRecorder integration 2 Rewrote upload/submit tests to use UI interactions instead of capturing controller from context; upgraded EventEmitterMock to store/dispatch events and MediaRecorderMock to simulate stop()→dataavailable flow

Production code changes

File Change
Dialog/Alert.tsx, MessageComposer/QuotedMessageIndicator.tsx Added missing import React
~14 files across MediaRecorder, TextareaComposer, Poll, Location Barrel → direct imports to break circular deps
ChannelListItem/ChannelListItem.tsx Restored Preview prop lost during rename
TypingIndicator/hooks/useDebouncedTypingActive.ts Added JSDoc warning about user?.id requirement

Mock infrastructure improvements

File Change
mock-builders/browser/EventEmitter.js Now stores listeners and supports emit() for realistic event dispatch
mock-builders/browser/MediaRecorder.js Tracks state transitions; autoEmitDataOnStop static flag simulates browser's stop()→dataavailable flow for integration tests

Known follow-up

  • Circular dependency root cause: Children of MessageComposer call useMessageComposerController() instead of reading the controller from context — ideally the controller should be exposed via MessageComposerContext

🤖 Generated with Claude Code

Replace barrel imports from MessageComposer with direct file imports to
break circular dependency chains (MessageComposer → MediaRecorder →
MessageComposer). Add missing React imports in Alert.tsx and
QuotedMessageIndicator.tsx. Restore Preview prop on ChannelListItem lost
during rename. Add JSDoc warning to useDebouncedTypingActive about the
user?.id requirement.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link

github-actions bot commented Mar 21, 2026

Size Change: +613 B (+0.14%)

Total Size: 441 kB

Filename Size Change
./dist/cjs/emojis.js 2.96 kB +3 B (+0.1%)
./dist/cjs/index.js 237 kB +606 B (+0.26%)
./dist/WithAudioPlayback-CnG9hoEn.js 0 B -88.3 kB (removed) 🏆
./dist/WithAudioPlayback-TERIQpZ6.js 88.3 kB +88.3 kB (new file) 🆕
ℹ️ View Unchanged
Filename Size
./dist/audioProcessing-BbOs2wMd.js 1.32 kB
./dist/cjs/mp3-encoder.js 1.27 kB
./dist/css/index.css 46.5 kB
./dist/css/v2/emoji-mart.css 1.84 kB
./dist/css/v2/emoji-replacement.css 300 B
./dist/css/v2/index.css 39.4 kB
./dist/css/v2/index.layout.css 22.8 kB

compressed-size-action

@oliverlaz oliverlaz force-pushed the fix/stabilize-v14-tests branch from 8bfce44 to ed20417 Compare March 21, 2026 22:50
@codecov
Copy link

codecov bot commented Mar 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.26%. Comparing base (73f8767) to head (7735ab4).
⚠️ Report is 142 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3039      +/-   ##
==========================================
+ Coverage   80.05%   80.26%   +0.21%     
==========================================
  Files         511      561      +50     
  Lines       10803    13107    +2304     
  Branches     2711     3417     +706     
==========================================
+ Hits         8648    10520    +1872     
- Misses       1902     1922      +20     
- Partials      253      665     +412     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

Update 67 test suites (506 tests) to match v14 implementation changes:

- Avatar: rename image→imageUrl, name→userName, add required size prop
- Message: remove editing from context, update handleDelete signature,
  rename MessageDeleted→MessageDeletedBubble
- MessageComposer: update cooldown API, fix SendButton queries, update
  quote action text
- Reactions: rewrite for new dialog-based ReactionSelector/MessageReactions
- ChannelList: update for new Search component, fix mobile nav viewport
- Components: add missing context providers (DialogManager, ChatView)
- Snapshots: regenerate stale external snapshots, replace Prettier-3
  incompatible inline snapshots with structural assertions
- TypingIndicator: fix test data (user must be object with id, not string)
- Fix all lint warnings (unused vars, sort-keys, require-await, sort-imports)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@oliverlaz oliverlaz force-pushed the fix/stabilize-v14-tests branch from ed20417 to 7735ab4 Compare March 21, 2026 23:07
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.

1 participant