Skip to content

Commit 331d4ba

Browse files
committed
msglist test: Rearrange the substitute for a StreamUpdateEvent
This way setupMessageListPage takes care of putting the data in place, which aligns with the structure of this file's other tests.
1 parent ffa2d32 commit 331d4ba

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

test/widgets/message_list_test.dart

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -315,19 +315,18 @@ void main() {
315315
});
316316

317317
testWidgets('show stream name from stream data when known', (tester) async {
318-
final stream = eg.stream(name: 'old stream name');
318+
final streamBefore = eg.stream(name: 'old stream name');
319+
// TODO(#182) this test would be more realistic using a StreamUpdateEvent
320+
final streamAfter = ZulipStream.fromJson({
321+
...(deepToJson(streamBefore) as Map<String, dynamic>),
322+
'name': 'new stream name',
323+
});
319324
await setupMessageListPage(tester,
320325
narrow: const AllMessagesNarrow(),
326+
streams: [streamAfter],
321327
messages: [
322-
eg.streamMessage(stream: stream),
328+
eg.streamMessage(stream: streamBefore),
323329
]);
324-
// TODO(#182) this test would be more realistic using a StreamUpdateEvent
325-
store.handleEvent(StreamCreateEvent(id: stream.streamId, streams: [
326-
ZulipStream.fromJson({
327-
...(deepToJson(stream) as Map<String, dynamic>),
328-
'name': 'new stream name',
329-
}),
330-
]));
331330
await tester.pump();
332331
tester.widget(find.text('new stream name'));
333332
});

0 commit comments

Comments
 (0)