@@ -37,6 +37,11 @@ void main() {
37
37
List <User > users = const [],
38
38
List <ZulipStream > streams = const [],
39
39
}) async {
40
+ if (narrow is ChannelNarrow || narrow is TopicNarrow ) {
41
+ final channelId = narrow is ChannelNarrow ? narrow.streamId : (narrow as TopicNarrow ).streamId;
42
+ assert (streams.any ((stream) => stream.streamId == channelId),
43
+ 'Add a channel with "streamId" the same as of $narrow .streamId to the store.' );
44
+ }
40
45
addTearDown (testBinding.reset);
41
46
final account = eg.account (user: selfUser ?? eg.selfUser);
42
47
await testBinding.globalStore.add (account, eg.initialSnapshot (
@@ -188,15 +193,17 @@ void main() {
188
193
}
189
194
190
195
testWidgets ('_StreamComposeBox' , (tester) async {
196
+ final channel = eg.stream ();
191
197
final key = await prepareComposeBox (tester,
192
- narrow: ChannelNarrow (eg. stream (). streamId));
198
+ narrow: ChannelNarrow (channel. streamId), streams : [channel] );
193
199
checkComposeBoxTextFields (tester, controllerKey: key,
194
200
expectTopicTextField: true );
195
201
});
196
202
197
203
testWidgets ('_FixedDestinationComposeBox' , (tester) async {
204
+ final channel = eg.stream ();
198
205
final key = await prepareComposeBox (tester,
199
- narrow: TopicNarrow . ofMessage (eg. streamMessage ()) );
206
+ narrow: TopicNarrow (channel.streamId, 'topic' ), streams : [channel] );
200
207
checkComposeBoxTextFields (tester, controllerKey: key,
201
208
expectTopicTextField: false );
202
209
});
@@ -207,7 +214,8 @@ void main() {
207
214
required void Function (int messageId) prepareResponse,
208
215
}) async {
209
216
final zulipLocalizations = GlobalLocalizations .zulipLocalizations;
210
- await prepareComposeBox (tester, narrow: const TopicNarrow (123 , 'some topic' ));
217
+ await prepareComposeBox (tester, narrow: const TopicNarrow (123 , 'some topic' ),
218
+ streams: [eg.stream (streamId: 123 )]);
211
219
212
220
final contentInputFinder = find.byWidgetPredicate (
213
221
(widget) => widget is TextField && widget.controller is ComposeContentController );
@@ -271,7 +279,9 @@ void main() {
271
279
272
280
group ('attach from media library' , () {
273
281
testWidgets ('success' , (tester) async {
274
- final controllerKey = await prepareComposeBox (tester, narrow: ChannelNarrow (eg.stream ().streamId));
282
+ final channel = eg.stream ();
283
+ final controllerKey = await prepareComposeBox (tester,
284
+ narrow: ChannelNarrow (channel.streamId), streams: [channel]);
275
285
final composeBoxController = controllerKey.currentState! ;
276
286
277
287
// (When we check that the send button looks disabled, it should be because
@@ -326,8 +336,10 @@ void main() {
326
336
});
327
337
328
338
group ('attach from camera' , () {
329
- testWidgets ('success' , (tester) async {
330
- final controllerKey = await prepareComposeBox (tester, narrow: ChannelNarrow (eg.stream ().streamId));
339
+ testWidgets ('succMessageListPageState.narrowess' , (tester) async {
340
+ final channel = eg.stream ();
341
+ final controllerKey = await prepareComposeBox (tester,
342
+ narrow: ChannelNarrow (channel.streamId), streams: [channel]);
331
343
final composeBoxController = controllerKey.currentState! ;
332
344
333
345
// (When we check that the send button looks disabled, it should be because
0 commit comments