@@ -37,6 +37,11 @@ void main() {
3737 List <User > users = const [],
3838 List <ZulipStream > streams = const [],
3939 }) 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+ }
4045 addTearDown (testBinding.reset);
4146 final account = eg.account (user: selfUser ?? eg.selfUser);
4247 await testBinding.globalStore.add (account, eg.initialSnapshot (
@@ -188,15 +193,17 @@ void main() {
188193 }
189194
190195 testWidgets ('_StreamComposeBox' , (tester) async {
196+ final channel = eg.stream ();
191197 final key = await prepareComposeBox (tester,
192- narrow: ChannelNarrow (eg. stream (). streamId));
198+ narrow: ChannelNarrow (channel. streamId), streams : [channel] );
193199 checkComposeBoxTextFields (tester, controllerKey: key,
194200 expectTopicTextField: true );
195201 });
196202
197203 testWidgets ('_FixedDestinationComposeBox' , (tester) async {
204+ final channel = eg.stream ();
198205 final key = await prepareComposeBox (tester,
199- narrow: TopicNarrow . ofMessage (eg. streamMessage ()) );
206+ narrow: TopicNarrow (channel.streamId, 'topic' ), streams : [channel] );
200207 checkComposeBoxTextFields (tester, controllerKey: key,
201208 expectTopicTextField: false );
202209 });
@@ -207,7 +214,8 @@ void main() {
207214 required void Function (int messageId) prepareResponse,
208215 }) async {
209216 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 )]);
211219
212220 final contentInputFinder = find.byWidgetPredicate (
213221 (widget) => widget is TextField && widget.controller is ComposeContentController );
@@ -271,7 +279,9 @@ void main() {
271279
272280 group ('attach from media library' , () {
273281 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]);
275285 final composeBoxController = controllerKey.currentState! ;
276286
277287 // (When we check that the send button looks disabled, it should be because
@@ -326,8 +336,10 @@ void main() {
326336 });
327337
328338 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]);
331343 final composeBoxController = controllerKey.currentState! ;
332344
333345 // (When we check that the send button looks disabled, it should be because
0 commit comments