Skip to content

Commit 3b4fa2b

Browse files
gnpricechrisbobbe
authored andcommitted
test [nfc]: Make addSubscription async
This is the next step toward making handleEvent async.
1 parent c570d56 commit 3b4fa2b

File tree

5 files changed

+17
-17
lines changed

5 files changed

+17
-17
lines changed

test/model/message_list_test.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ void main() async {
4141
subscription = eg.subscription(stream);
4242
store = eg.store();
4343
await store.addStream(stream);
44-
store.addSubscription(subscription);
44+
await store.addSubscription(subscription);
4545
connection = store.connection as FakeApiConnection;
4646
notifiedCount = 0;
4747
model = MessageListView.init(store: store, narrow: narrow)
@@ -560,9 +560,9 @@ void main() async {
560560
final stream2 = eg.stream(streamId: 2, name: 'stream 2');
561561
await prepare(narrow: const AllMessagesNarrow());
562562
await store.addStreams([stream1, stream2]);
563-
store.addSubscription(eg.subscription(stream1));
563+
await store.addSubscription(eg.subscription(stream1));
564564
store.addUserTopic(stream1, 'B', UserTopicVisibilityPolicy.muted);
565-
store.addSubscription(eg.subscription(stream2, isMuted: true));
565+
await store.addSubscription(eg.subscription(stream2, isMuted: true));
566566
store.addUserTopic(stream2, 'C', UserTopicVisibilityPolicy.unmuted);
567567

568568
// Check filtering on fetchInitial…
@@ -617,7 +617,7 @@ void main() async {
617617
final stream = eg.stream(streamId: 1, name: 'stream 1');
618618
await prepare(narrow: StreamNarrow(stream.streamId));
619619
await store.addStream(stream);
620-
store.addSubscription(eg.subscription(stream, isMuted: true));
620+
await store.addSubscription(eg.subscription(stream, isMuted: true));
621621
store.addUserTopic(stream, 'A', UserTopicVisibilityPolicy.unmuted);
622622
store.addUserTopic(stream, 'C', UserTopicVisibilityPolicy.muted);
623623

@@ -661,7 +661,7 @@ void main() async {
661661
final stream = eg.stream(streamId: 1, name: 'stream 1');
662662
await prepare(narrow: TopicNarrow(stream.streamId, 'A'));
663663
await store.addStream(stream);
664-
store.addSubscription(eg.subscription(stream, isMuted: true));
664+
await store.addSubscription(eg.subscription(stream, isMuted: true));
665665
store.addUserTopic(stream, 'A', UserTopicVisibilityPolicy.muted);
666666

667667
// Check filtering on fetchInitial…

test/model/stream_test.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ void main() {
5454
await store.addStream(stream2);
5555
checkUnified(store);
5656

57-
store.addSubscription(eg.subscription(stream1));
57+
await store.addSubscription(eg.subscription(stream1));
5858
checkUnified(store);
5959
});
6060
});
@@ -141,15 +141,15 @@ void main() {
141141
test('with policy none, stream not muted', () async {
142142
final store = eg.store();
143143
await store.addStream(stream1);
144-
store.addSubscription(eg.subscription(stream1));
144+
await store.addSubscription(eg.subscription(stream1));
145145
check(store.isTopicVisibleInStream(stream1.streamId, 'topic')).isTrue();
146146
check(store.isTopicVisible (stream1.streamId, 'topic')).isTrue();
147147
});
148148

149149
test('with policy none, stream muted', () async {
150150
final store = eg.store();
151151
await store.addStream(stream1);
152-
store.addSubscription(eg.subscription(stream1, isMuted: true));
152+
await store.addSubscription(eg.subscription(stream1, isMuted: true));
153153
check(store.isTopicVisibleInStream(stream1.streamId, 'topic')).isTrue();
154154
check(store.isTopicVisible (stream1.streamId, 'topic')).isFalse();
155155
});
@@ -164,7 +164,7 @@ void main() {
164164
test('with policy muted', () async {
165165
final store = eg.store();
166166
await store.addStream(stream1);
167-
store.addSubscription(eg.subscription(stream1));
167+
await store.addSubscription(eg.subscription(stream1));
168168
store.addUserTopic(stream1, 'topic', UserTopicVisibilityPolicy.muted);
169169
check(store.isTopicVisibleInStream(stream1.streamId, 'topic')).isFalse();
170170
check(store.isTopicVisible (stream1.streamId, 'topic')).isFalse();
@@ -173,7 +173,7 @@ void main() {
173173
test('with policy unmuted', () async {
174174
final store = eg.store();
175175
await store.addStream(stream1);
176-
store.addSubscription(eg.subscription(stream1, isMuted: true));
176+
await store.addSubscription(eg.subscription(stream1, isMuted: true));
177177
store.addUserTopic(stream1, 'topic', UserTopicVisibilityPolicy.unmuted);
178178
check(store.isTopicVisibleInStream(stream1.streamId, 'topic')).isTrue();
179179
check(store.isTopicVisible (stream1.streamId, 'topic')).isTrue();
@@ -182,7 +182,7 @@ void main() {
182182
test('with policy followed', () async {
183183
final store = eg.store();
184184
await store.addStream(stream1);
185-
store.addSubscription(eg.subscription(stream1, isMuted: true));
185+
await store.addSubscription(eg.subscription(stream1, isMuted: true));
186186
store.addUserTopic(stream1, 'topic', UserTopicVisibilityPolicy.followed);
187187
check(store.isTopicVisibleInStream(stream1.streamId, 'topic')).isTrue();
188188
check(store.isTopicVisible (stream1.streamId, 'topic')).isTrue();

test/model/test_store.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ extension PerAccountStoreTestExtension on PerAccountStore {
132132
handleEvent(StreamCreateEvent(id: 1, streams: streams));
133133
}
134134

135-
void addSubscription(Subscription subscription) {
135+
Future<void> addSubscription(Subscription subscription) async {
136136
addSubscriptions([subscription]);
137137
}
138138

test/model/unreads_test.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,9 @@ void main() {
158158
final stream3 = eg.stream(streamId: 3, name: 'stream 3');
159159
prepare();
160160
await streamStore.addStreams([stream1, stream2, stream3]);
161-
streamStore.addSubscription(eg.subscription(stream1));
162-
streamStore.addSubscription(eg.subscription(stream2));
163-
streamStore.addSubscription(eg.subscription(stream3, isMuted: true));
161+
await streamStore.addSubscription(eg.subscription(stream1));
162+
await streamStore.addSubscription(eg.subscription(stream2));
163+
await streamStore.addSubscription(eg.subscription(stream3, isMuted: true));
164164
streamStore.addUserTopic(stream1, 'a', UserTopicVisibilityPolicy.muted);
165165
fillWithMessages([
166166
eg.streamMessage(stream: stream1, topic: 'a', flags: []),
@@ -178,7 +178,7 @@ void main() {
178178
final stream = eg.stream();
179179
prepare();
180180
await streamStore.addStream(stream);
181-
streamStore.addSubscription(eg.subscription(stream));
181+
await streamStore.addSubscription(eg.subscription(stream));
182182
streamStore.addUserTopic(stream, 'a', UserTopicVisibilityPolicy.unmuted);
183183
streamStore.addUserTopic(stream, 'c', UserTopicVisibilityPolicy.muted);
184184
fillWithMessages([

test/widgets/action_sheet_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Future<void> setupToMessageActionSheet(WidgetTester tester, {
4343
if (message is StreamMessage) {
4444
final stream = eg.stream(streamId: message.streamId);
4545
await store.addStream(stream);
46-
store.addSubscription(eg.subscription(stream));
46+
await store.addSubscription(eg.subscription(stream));
4747
}
4848
final connection = store.connection as FakeApiConnection;
4949

0 commit comments

Comments
 (0)