Skip to content

Commit

Permalink
msglist test [nfc]: Cut some redundant per-case store and connection …
Browse files Browse the repository at this point in the history
…locals

These already exist as late variables at the top of `main`,
and at each of these lines they've already been set by the
setupMessageListPage helper to exactly the same values
found here.
  • Loading branch information
gnprice authored and chrisbobbe committed Feb 6, 2024
1 parent 6956d5d commit 2ff6d78
Showing 1 changed file with 0 additions and 10 deletions.
10 changes: 0 additions & 10 deletions test/widgets/message_list_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,6 @@ void main() {
}

Future<void> handleNewAvatarEventAndPump(WidgetTester tester, String avatarUrl) async {
final store = await testBinding.globalStore.perAccount(eg.selfAccount.id);
store.handleEvent(RealmUserUpdateEvent(id: 1, userId: eg.selfUser.userId, avatarUrl: avatarUrl));
await tester.pump();
}
Expand Down Expand Up @@ -629,7 +628,6 @@ void main() {
narrow: narrow, messages: [message], unreadMsgs: unreadMsgs);
check(isMarkAsReadButtonVisible(tester)).isTrue();

final connection = store.connection as FakeApiConnection;
connection.prepare(json: UpdateMessageFlagsForNarrowResult(
processedCount: 11, updatedCount: 3,
firstProcessedId: null, lastProcessedId: null,
Expand Down Expand Up @@ -658,7 +656,6 @@ void main() {
narrow: narrow, messages: [message], unreadMsgs: unreadMsgs);
check(isMarkAsReadButtonVisible(tester)).isTrue();

final connection = store.connection as FakeApiConnection;
connection.prepare(json: UpdateMessageFlagsForNarrowResult(
processedCount: 11, updatedCount: 3,
firstProcessedId: null, lastProcessedId: null,
Expand Down Expand Up @@ -688,7 +685,6 @@ void main() {
narrow: narrow, messages: [message], unreadMsgs: unreadMsgs);
check(isMarkAsReadButtonVisible(tester)).isTrue();

final connection = store.connection as FakeApiConnection;
connection.prepare(json: UpdateMessageFlagsForNarrowResult(
processedCount: 1000, updatedCount: 890,
firstProcessedId: 1, lastProcessedId: 1989,
Expand Down Expand Up @@ -735,7 +731,6 @@ void main() {
narrow: narrow, messages: [message], unreadMsgs: unreadMsgs);
check(isMarkAsReadButtonVisible(tester)).isTrue();

final connection = store.connection as FakeApiConnection;
connection.prepare(json: UpdateMessageFlagsForNarrowResult(
processedCount: 1000, updatedCount: 0,
firstProcessedId: null, lastProcessedId: null,
Expand Down Expand Up @@ -767,7 +762,6 @@ void main() {
narrow: narrow, messages: [message], unreadMsgs: unreadMsgs);
check(isMarkAsReadButtonVisible(tester)).isTrue();

final connection = store.connection as FakeApiConnection;
connection.zulipFeatureLevel = 154;
connection.prepare(json: {});
await tester.tap(find.byType(MarkAsReadWidget));
Expand All @@ -785,7 +779,6 @@ void main() {
narrow: narrow, messages: [message], unreadMsgs: unreadMsgs);
check(isMarkAsReadButtonVisible(tester)).isTrue();

final connection = store.connection as FakeApiConnection;
connection.zulipFeatureLevel = 154;
connection.prepare(json: {});
await tester.tap(find.byType(MarkAsReadWidget));
Expand All @@ -805,7 +798,6 @@ void main() {
narrow: narrow, messages: [message], unreadMsgs: unreadMsgs);
check(isMarkAsReadButtonVisible(tester)).isTrue();

final connection = store.connection as FakeApiConnection;
connection.zulipFeatureLevel = 154;
connection.prepare(json: {});
await tester.tap(find.byType(MarkAsReadWidget));
Expand All @@ -831,7 +823,6 @@ void main() {
narrow: narrow, messages: [message], unreadMsgs: unreadMsgs);
check(isMarkAsReadButtonVisible(tester)).isTrue();

final connection = store.connection as FakeApiConnection;
connection.zulipFeatureLevel = 154;
connection.prepare(json:
UpdateMessageFlagsResult(messages: [message.id]).toJson());
Expand All @@ -855,7 +846,6 @@ void main() {
narrow: narrow, messages: [message], unreadMsgs: unreadMsgs);
check(isMarkAsReadButtonVisible(tester)).isTrue();

final connection = store.connection as FakeApiConnection;
connection.prepare(exception: http.ClientException('Oops'));
await tester.tap(find.byType(MarkAsReadWidget));
await tester.pumpAndSettle();
Expand Down

0 comments on commit 2ff6d78

Please sign in to comment.