@@ -154,7 +154,7 @@ void main() {
154154 testWidgets ('MessageListPageState.narrow' , (tester) async {
155155 final stream = eg.stream ();
156156 await setupMessageListPage (tester, narrow: ChannelNarrow (stream.streamId),
157- streams : [stream],
157+ subscriptions : [eg. subscription ( stream) ],
158158 messages: [eg.streamMessage (stream: stream, content: "<p>a message</p>" )]);
159159 final state = MessageListPage .ancestorOf (tester.element (find.text ("a message" )));
160160 check (state.narrow).equals (ChannelNarrow (stream.streamId));
@@ -167,7 +167,7 @@ void main() {
167167 final topic = eg.defaultRealmEmptyTopicDisplayName;
168168 final topicNarrow = eg.topicNarrow (stream.streamId, topic);
169169 await setupMessageListPage (tester, narrow: topicNarrow,
170- streams : [stream],
170+ subscriptions : [eg. subscription ( stream) ],
171171 messages: [eg.streamMessage (stream: stream, topic: topic, content: "<p>a message</p>" )]);
172172 final state = MessageListPage .ancestorOf (tester.element (find.text ("a message" )));
173173 // The page's narrow has been updated; the topic is "", not "general chat".
@@ -177,7 +177,7 @@ void main() {
177177 testWidgets ('composeBoxState finds compose box' , (tester) async {
178178 final stream = eg.stream ();
179179 await setupMessageListPage (tester, narrow: ChannelNarrow (stream.streamId),
180- streams : [stream],
180+ subscriptions : [eg. subscription ( stream) ],
181181 messages: [eg.streamMessage (stream: stream, content: "<p>a message</p>" )]);
182182 final state = MessageListPage .ancestorOf (tester.element (find.text ("a message" )));
183183 check (state.composeBoxState).isNotNull ();
@@ -238,7 +238,7 @@ void main() {
238238 final channel = eg.stream ();
239239 await setupMessageListPage (tester,
240240 narrow: eg.topicNarrow (channel.streamId, '' ),
241- streams : [channel],
241+ subscriptions : [eg. subscription ( channel) ],
242242 messageCount: 1 );
243243 checkAppBarChannelTopic (
244244 channel.name, eg.defaultRealmEmptyTopicDisplayName);
@@ -281,7 +281,7 @@ void main() {
281281 final channel = eg.stream ();
282282 await setupMessageListPage (tester, narrow: eg.topicNarrow (channel.streamId, 'hi' ),
283283 navObservers: [navObserver],
284- streams : [channel], messageCount: 1 );
284+ subscriptions : [eg. subscription ( channel) ], messageCount: 1 );
285285
286286 // Clear out initial route.
287287 assert (pushedRoutes.length == 1 );
@@ -298,7 +298,7 @@ void main() {
298298 final channel = eg.stream (name: 'channel foo' );
299299 await setupMessageListPage (tester,
300300 narrow: eg.topicNarrow (channel.streamId, 'topic foo' ),
301- streams : [channel],
301+ subscriptions : [eg. subscription ( channel) ],
302302 messages: [eg.streamMessage (stream: channel, topic: 'topic foo' )]);
303303
304304 connection.prepare (json: GetStreamTopicsResult (topics: [
@@ -333,7 +333,7 @@ void main() {
333333 final channel = eg.stream (name: 'channel foo' );
334334 await setupMessageListPage (tester,
335335 narrow: ChannelNarrow (channel.streamId),
336- streams : [channel],
336+ subscriptions : [eg. subscription ( channel) ],
337337 messages: [eg.streamMessage (stream: channel, topic: 'topic foo' )]);
338338
339339 connection.prepare (json: GetStreamTopicsResult (topics: [
@@ -390,7 +390,7 @@ void main() {
390390 final channel = eg.stream ();
391391 await setupMessageListPage (tester,
392392 narrow: TopicNarrow (channel.streamId, eg.t ('topic' )),
393- streams : [channel],
393+ subscriptions : [eg. subscription ( channel) ],
394394 messages: []);
395395 check (findPlaceholder).findsOne ();
396396
@@ -488,9 +488,11 @@ void main() {
488488
489489 group ('topic permalink' , () {
490490 final someStream = eg.stream ();
491+ final someSubscription = eg.subscription (someStream);
491492 const someTopic = 'some topic' ;
492493
493494 final otherStream = eg.stream ();
495+ final otherSubscription = eg.subscription (otherStream);
494496 const otherTopic = 'other topic' ;
495497
496498 testWidgets ('with message move' , (tester) async {
@@ -499,7 +501,7 @@ void main() {
499501 narrow: narrow,
500502 // server sends the /with/<id> message in its current, different location
501503 messages: [eg.streamMessage (id: 1 , stream: otherStream, topic: otherTopic)],
502- streams : [someStream, otherStream ],
504+ subscriptions : [someSubscription, otherSubscription ],
503505 skipPumpAndSettle: true );
504506 await tester.pump (); // global store loaded
505507 await tester.pump (); // per-account store loaded
@@ -533,7 +535,7 @@ void main() {
533535 narrow: narrow,
534536 // server sends the /with/<id> message in its current, different location
535537 messages: [eg.streamMessage (id: 1 , stream: someStream, topic: someTopic)],
536- streams : [someStream ],
538+ subscriptions : [someSubscription ],
537539 skipPumpAndSettle: true );
538540 await tester.pump (); // global store loaded
539541 await tester.pump (); // per-account store loaded
@@ -1182,7 +1184,9 @@ void main() {
11821184 group ('Update Narrow on message move' , () {
11831185 const topic = 'foo' ;
11841186 final channel = eg.stream ();
1187+ final subscription = eg.subscription (channel);
11851188 final otherChannel = eg.stream ();
1189+ final otherSubscription = eg.subscription (otherChannel);
11861190 final narrow = eg.topicNarrow (channel.streamId, topic);
11871191
11881192 void prepareGetMessageResponse (List <Message > messages) {
@@ -1200,7 +1204,10 @@ void main() {
12001204
12011205 testWidgets ('compose box send message after move' , (tester) async {
12021206 final message = eg.streamMessage (stream: channel, topic: topic, content: 'Message to move' );
1203- await setupMessageListPage (tester, narrow: narrow, messages: [message], streams: [channel, otherChannel]);
1207+ await setupMessageListPage (tester,
1208+ narrow: narrow,
1209+ messages: [message],
1210+ subscriptions: [subscription, otherSubscription]);
12041211
12051212 final channelContentInputFinder = find.descendant (
12061213 of: find.byType (ComposeAutocomplete ),
@@ -1240,7 +1247,8 @@ void main() {
12401247
12411248 testWidgets ('Move to narrow with existing messages' , (tester) async {
12421249 final message = eg.streamMessage (stream: channel, topic: topic, content: 'Message to move' );
1243- await setupMessageListPage (tester, narrow: narrow, messages: [message], streams: [channel]);
1250+ await setupMessageListPage (tester,
1251+ narrow: narrow, messages: [message], subscriptions: [subscription]);
12441252 check (find.textContaining ('Existing message' ).evaluate ()).length.equals (0 );
12451253 check (find.textContaining ('Message to move' ).evaluate ()).length.equals (1 );
12461254
@@ -1256,7 +1264,8 @@ void main() {
12561264
12571265 testWidgets ('show new topic in TopicNarrow after move' , (tester) async {
12581266 final message = eg.streamMessage (stream: channel, topic: topic, content: 'Message to move' );
1259- await setupMessageListPage (tester, narrow: narrow, messages: [message], streams: [channel]);
1267+ await setupMessageListPage (tester,
1268+ narrow: narrow, messages: [message], subscriptions: [subscription]);
12601269
12611270 prepareGetMessageResponse ([message]);
12621271 await handleMessageMoveEvent ([message], 'new topic' );
@@ -1315,7 +1324,7 @@ void main() {
13151324 testWidgets ('do not show channel name in ChannelNarrow' , (tester) async {
13161325 await setupMessageListPage (tester,
13171326 narrow: ChannelNarrow (stream.streamId),
1318- messages: [message], streams : [stream]);
1327+ messages: [message], subscriptions : [eg. subscription ( stream) ]);
13191328 await tester.pump ();
13201329 check (findInMessageList ('stream name' )).length.equals (0 );
13211330 check (findInMessageList ('topic name' )).length.equals (1 );
@@ -1324,7 +1333,7 @@ void main() {
13241333 testWidgets ('do not show stream name in TopicNarrow' , (tester) async {
13251334 await setupMessageListPage (tester,
13261335 narrow: TopicNarrow .ofMessage (message),
1327- messages: [message], streams : [stream]);
1336+ messages: [message], subscriptions : [eg. subscription ( stream) ]);
13281337 await tester.pump ();
13291338 check (findInMessageList ('stream name' )).length.equals (0 );
13301339 check (findInMessageList ('topic name' )).length.equals (1 );
@@ -1505,7 +1514,7 @@ void main() {
15051514 final message = eg.streamMessage (stream: channel, topic: 'topic name' );
15061515 await setupMessageListPage (tester,
15071516 narrow: ChannelNarrow (channel.streamId),
1508- streams : [channel],
1517+ subscriptions : [eg. subscription ( channel) ],
15091518 messages: [message],
15101519 navObservers: [navObserver]);
15111520
@@ -1531,7 +1540,7 @@ void main() {
15311540 final message = eg.streamMessage (stream: channel, topic: 'topic name' );
15321541 await setupMessageListPage (tester,
15331542 narrow: TopicNarrow .ofMessage (message),
1534- streams : [channel],
1543+ subscriptions : [eg. subscription ( channel) ],
15351544 messages: [message],
15361545 navObservers: [navObserver]);
15371546
@@ -2136,7 +2145,7 @@ void main() {
21362145
21372146 testWidgets ('hidden -> waiting' , (tester) async {
21382147 await setupMessageListPage (tester,
2139- narrow: topicNarrow, streams : [stream],
2148+ narrow: topicNarrow, subscriptions : [eg. subscription ( stream) ],
21402149 messages: []);
21412150
21422151 await sendMessageAndSucceed (tester);
@@ -2152,7 +2161,7 @@ void main() {
21522161
21532162 testWidgets ('hidden -> failed, tap to restore message' , (tester) async {
21542163 await setupMessageListPage (tester,
2155- narrow: topicNarrow, streams : [stream],
2164+ narrow: topicNarrow, subscriptions : [eg. subscription ( stream) ],
21562165 messages: []);
21572166 // Send a message and fail. Dismiss the error dialog as it pops up.
21582167 await sendMessageAndFail (tester);
@@ -2200,7 +2209,7 @@ void main() {
22002209
22012210 testWidgets ('waiting -> waitPeriodExpired, tap to restore message' , (tester) async {
22022211 await setupMessageListPage (tester,
2203- narrow: topicNarrow, streams : [stream],
2212+ narrow: topicNarrow, subscriptions : [eg. subscription ( stream) ],
22042213 messages: []);
22052214 await sendMessageAndFail (tester,
22062215 delay: kSendMessageOfferRestoreWaitPeriod + const Duration (seconds: 1 ));
0 commit comments