@@ -599,9 +599,19 @@ void main() {
599
599
streamMessage (id: 60 , senderId: 4 ),
600
600
];
601
601
602
- Future <void > prepareStore ({ bool includeMessageHistory = false } ) async {
602
+ Future <void > prepareStore () async {
603
603
await prepare (users: users, dmConversations: dmConversations,
604
- messages: includeMessageHistory ? messages : []);
604
+ messages: messages);
605
+ }
606
+
607
+ Future <void > fetchInitialMessagesIn (Narrow narrow) async {
608
+ final connection = store.connection as FakeApiConnection ;
609
+ connection.prepare (json: newestResult (
610
+ foundOldest: false ,
611
+ messages: messages.where ((m) => m.topic == topic).toList (),
612
+ ).toJson ());
613
+ final messageList = MessageListView .init (store: store, narrow: narrow);
614
+ await messageList.fetchInitial ();
605
615
}
606
616
607
617
Future <void > checkResultsIn (Narrow narrow, {required List <int > expected}) async {
@@ -617,31 +627,9 @@ void main() {
617
627
check (results).deepEquals (expected);
618
628
}
619
629
620
- late FakeApiConnection connection;
621
- late MessageListView messageList;
622
-
623
- Future <void > fetchInitialMessagesIn (Narrow narrow) async {
624
- connection = store.connection as FakeApiConnection ;
625
- connection.prepare (json: newestResult (
626
- foundOldest: false ,
627
- messages: narrow is StreamNarrow
628
- ? messages
629
- : messages.where ((m) => m.topic == topic).toList (),
630
- ).toJson ());
631
- messageList = MessageListView .init (store: store, narrow: narrow);
632
- await messageList.fetchInitial ();
633
- }
634
-
635
- Future <void > checkInitialResultsIn (Narrow narrow,
636
- {required List <int > expected, bool includeStream = false }) async {
637
- assert (narrow is ! StreamNarrow || ! includeStream);
638
- await prepareStore (includeMessageHistory: includeStream);
639
- await fetchInitialMessagesIn (narrow);
640
- await checkResultsIn (narrow, expected: expected);
641
- }
642
-
643
- await checkInitialResultsIn (topicNarrow, expected: [0 , 4 , 3 , 1 , 2 ],
644
- includeStream: true );
630
+ await prepareStore ();
631
+ await fetchInitialMessagesIn (topicNarrow);
632
+ await checkResultsIn (topicNarrow, expected: [0 , 4 , 3 , 1 , 2 ]);
645
633
});
646
634
});
647
635
}
0 commit comments