Skip to content

Commit dc1c806

Browse files
committed
store test [nfc]: Remove redundant awaitFakeAsync
1 parent 7075045 commit dc1c806

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

test/model/store_test.dart

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,24 +1018,22 @@ void main() {
10181018
check(store).isLoading.isTrue();
10191019
}
10201020

1021-
void checkReloadFailure({
1021+
void checkReloadFailure(FakeAsync async, {
10221022
required FutureOr<void> Function() completeLoading,
1023-
}) {
1024-
awaitFakeAsync((async) async {
1025-
await prepareReload(async);
1026-
check(completers()).single.isCompleted.isFalse();
1023+
}) async {
1024+
await prepareReload(async);
1025+
check(completers()).single.isCompleted.isFalse();
10271026

1028-
await completeLoading();
1029-
check(completers()).single.isCompleted.isTrue();
1030-
check(globalStore.takeDoRemoveAccountCalls()).single.equals(eg.selfAccount.id);
1027+
await completeLoading();
1028+
check(completers()).single.isCompleted.isTrue();
1029+
check(globalStore.takeDoRemoveAccountCalls()).single.equals(eg.selfAccount.id);
10311030

1032-
async.elapse(TestGlobalStore.removeAccountDuration);
1033-
check(globalStore.perAccountSync(eg.selfAccount.id)).isNull();
1031+
async.elapse(TestGlobalStore.removeAccountDuration);
1032+
check(globalStore.perAccountSync(eg.selfAccount.id)).isNull();
10341033

1035-
async.flushTimers();
1036-
// Reload never succeeds and there are no unhandled errors.
1037-
check(globalStore.perAccountSync(eg.selfAccount.id)).isNull();
1038-
});
1034+
async.flushTimers();
1035+
// Reload never succeeds and there are no unhandled errors.
1036+
check(globalStore.perAccountSync(eg.selfAccount.id)).isNull();
10391037
}
10401038

10411039
Future<void> logOutAndCompleteWithNewStore() async {
@@ -1047,15 +1045,15 @@ void main() {
10471045
}
10481046

10491047
test('user logged out before new store is loaded', () => awaitFakeAsync((async) async {
1050-
checkReloadFailure(completeLoading: logOutAndCompleteWithNewStore);
1048+
checkReloadFailure(async, completeLoading: logOutAndCompleteWithNewStore);
10511049
}));
10521050

10531051
void completeWithApiExceptionUnauthorized() {
10541052
completers().single.completeError(eg.apiExceptionUnauthorized());
10551053
}
10561054

10571055
test('new store is not loaded, gets HTTP 401 error instead', () => awaitFakeAsync((async) async {
1058-
checkReloadFailure(completeLoading: completeWithApiExceptionUnauthorized);
1056+
checkReloadFailure(async, completeLoading: completeWithApiExceptionUnauthorized);
10591057
}));
10601058
});
10611059

0 commit comments

Comments
 (0)