Skip to content

Commit

Permalink
msglist test: Rearrange the substitute for a StreamUpdateEvent
Browse files Browse the repository at this point in the history
This way setupMessageListPage takes care of putting the data in
place, which aligns with the structure of this file's other tests.
  • Loading branch information
gnprice committed Dec 20, 2023
1 parent ffa2d32 commit 331d4ba
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions test/widgets/message_list_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -315,19 +315,18 @@ void main() {
});

testWidgets('show stream name from stream data when known', (tester) async {
final stream = eg.stream(name: 'old stream name');
final streamBefore = eg.stream(name: 'old stream name');
// TODO(#182) this test would be more realistic using a StreamUpdateEvent
final streamAfter = ZulipStream.fromJson({
...(deepToJson(streamBefore) as Map<String, dynamic>),
'name': 'new stream name',
});
await setupMessageListPage(tester,
narrow: const AllMessagesNarrow(),
streams: [streamAfter],
messages: [
eg.streamMessage(stream: stream),
eg.streamMessage(stream: streamBefore),
]);
// TODO(#182) this test would be more realistic using a StreamUpdateEvent
store.handleEvent(StreamCreateEvent(id: stream.streamId, streams: [
ZulipStream.fromJson({
...(deepToJson(stream) as Map<String, dynamic>),
'name': 'new stream name',
}),
]));
await tester.pump();
tester.widget(find.text('new stream name'));
});
Expand Down

0 comments on commit 331d4ba

Please sign in to comment.