@@ -113,37 +113,37 @@ void main() {
113
113
final someMessage = eg.streamMessage (
114
114
stream: someChannel, topic: someTopic, sender: eg.otherUser);
115
115
116
- group ('showTopicActionSheet' , () {
117
- Future <void > prepare ({
118
- ZulipStream ? channel,
119
- String topic = someTopic,
120
- bool isChannelSubscribed = true ,
121
- bool ? isChannelMuted,
122
- UserTopicVisibilityPolicy ? visibilityPolicy,
123
- UnreadMessagesSnapshot ? unreadMsgs,
124
- int ? zulipFeatureLevel,
125
- }) async {
126
- final effectiveChannel = channel ?? someChannel;
127
- assert (isChannelSubscribed || isChannelMuted == null );
128
-
129
- addTearDown (testBinding.reset);
130
-
131
- final account = eg.selfAccount.copyWith (zulipFeatureLevel: zulipFeatureLevel);
132
- await testBinding.globalStore.add (account, eg.initialSnapshot (
133
- realmUsers: [eg.selfUser, eg.otherUser],
134
- streams: [effectiveChannel],
135
- subscriptions: isChannelSubscribed
136
- ? [eg.subscription (effectiveChannel, isMuted: isChannelMuted ?? false )]
137
- : null ,
138
- userTopics: visibilityPolicy != null
139
- ? [eg.userTopicItem (effectiveChannel, topic, visibilityPolicy)]
140
- : null ,
141
- unreadMsgs: unreadMsgs,
142
- zulipFeatureLevel: zulipFeatureLevel));
143
- store = await testBinding.globalStore.perAccount (eg.selfAccount.id);
144
- connection = store.connection as FakeApiConnection ;
145
- }
116
+ Future <void > prepare ({
117
+ ZulipStream ? channel,
118
+ String topic = someTopic,
119
+ bool isChannelSubscribed = true ,
120
+ bool ? isChannelMuted,
121
+ UserTopicVisibilityPolicy ? visibilityPolicy,
122
+ UnreadMessagesSnapshot ? unreadMsgs,
123
+ int ? zulipFeatureLevel,
124
+ }) async {
125
+ final effectiveChannel = channel ?? someChannel;
126
+ assert (isChannelSubscribed || isChannelMuted == null );
127
+
128
+ addTearDown (testBinding.reset);
129
+
130
+ final account = eg.selfAccount.copyWith (zulipFeatureLevel: zulipFeatureLevel);
131
+ await testBinding.globalStore.add (account, eg.initialSnapshot (
132
+ realmUsers: [eg.selfUser, eg.otherUser],
133
+ streams: [effectiveChannel],
134
+ subscriptions: isChannelSubscribed
135
+ ? [eg.subscription (effectiveChannel, isMuted: isChannelMuted ?? false )]
136
+ : null ,
137
+ userTopics: visibilityPolicy != null
138
+ ? [eg.userTopicItem (effectiveChannel, topic, visibilityPolicy)]
139
+ : null ,
140
+ unreadMsgs: unreadMsgs,
141
+ zulipFeatureLevel: zulipFeatureLevel));
142
+ store = await testBinding.globalStore.perAccount (eg.selfAccount.id);
143
+ connection = store.connection as FakeApiConnection ;
144
+ }
146
145
146
+ group ('showTopicActionSheet' , () {
147
147
void checkButtons () {
148
148
final actionSheetFinder = find.byType (BottomSheet );
149
149
check (actionSheetFinder).findsOne ();
@@ -233,24 +233,20 @@ void main() {
233
233
234
234
channel = eg.stream ();
235
235
topic = 'isChannelMuted: $isChannelMuted , policy: $visibilityPolicy ' ;
236
-
237
- final account = eg.selfAccount.copyWith (zulipFeatureLevel: zulipFeatureLevel);
238
- final subscriptions = isChannelMuted == null ? < Subscription > []
239
- : [eg.subscription (channel, isMuted: isChannelMuted)];
240
- await testBinding.globalStore.add (account, eg.initialSnapshot (
241
- realmUsers: [eg.selfUser, eg.otherUser],
242
- streams: [channel],
243
- subscriptions: subscriptions,
244
- userTopics: [eg.userTopicItem (channel, topic, visibilityPolicy)],
245
- zulipFeatureLevel: zulipFeatureLevel));
246
- store = await testBinding.globalStore.perAccount (account.id);
247
- connection = store.connection as FakeApiConnection ;
236
+ await prepare (
237
+ channel: channel,
238
+ topic: topic,
239
+ isChannelSubscribed: isChannelMuted != null , // shorthand; see dartdoc
240
+ isChannelMuted: isChannelMuted,
241
+ visibilityPolicy: visibilityPolicy,
242
+ zulipFeatureLevel: zulipFeatureLevel,
243
+ );
248
244
249
245
final message = eg.streamMessage (
250
246
stream: channel, topic: topic, sender: eg.otherUser);
251
247
connection.prepare (json: eg.newestGetMessagesResult (
252
248
foundOldest: true , messages: [message]).toJson ());
253
- await tester.pumpWidget (TestZulipApp (accountId: account .id,
249
+ await tester.pumpWidget (TestZulipApp (accountId: eg.selfAccount .id,
254
250
child: MessageListPage (
255
251
initNarrow: eg.topicNarrow (channel.streamId, topic))));
256
252
await tester.pumpAndSettle ();
0 commit comments