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