Skip to content

Commit d30b6a1

Browse files
VelikovPetarclaude
andcommitted
test(llc): cover the last dispatch region's error guard
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent b85e8f6 commit d30b6a1

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

packages/stream_chat/test/src/client/channel/channel_event_handler_test.dart

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -888,6 +888,20 @@ void main() {
888888
verify(() => mutations.onMemberUpdated(member)).called(1);
889889
});
890890

891+
test('a throwing block 3 handler does not escape handleEvent', () {
892+
when(
893+
() => mutations.onUserStartWatching(any(), watcherCount: any(named: 'watcherCount')),
894+
).thenThrow(StateError('boom'));
895+
896+
handler.handleEvent(
897+
Event(type: EventType.userWatchingStart, user: otherUser),
898+
);
899+
900+
verify(
901+
() => mutations.onUserStartWatching(otherUser, watcherCount: null),
902+
).called(1);
903+
});
904+
891905
test('a contained error is logged rather than swallowed', () {
892906
when(() => mutations.onMemberAdded(any())).thenThrow(StateError('boom'));
893907

0 commit comments

Comments
 (0)