Skip to content

Commit c516066

Browse files
committed
store test: Add await for checking Future.throws.
These tests actually worked as expected, even though we didn't await for the Future returned by FutureChecks.throws. This is because checks ensure that the asychronous expectations are complete before the test ends. Nonetheless, we should use await so that our intention is explicit (i.e. the future completes with an error as opposed to the future never completes and can't be awaited). See also: https://github.com/dart-lang/test/tree/master/pkgs/checks#checking-asynchronous-expectations Signed-off-by: Zixuan James Li <[email protected]>
1 parent fa460f9 commit c516066

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

test/model/store_test.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,11 @@ void main() {
153153

154154
test('reject changing id, realmUrl, or userId', () async {
155155
final globalStore = eg.globalStore(accounts: [eg.selfAccount]);
156-
check(globalStore.updateAccount(eg.selfAccount.id, const AccountsCompanion(
156+
await check(globalStore.updateAccount(eg.selfAccount.id, const AccountsCompanion(
157157
id: Value(1234)))).throws();
158-
check(globalStore.updateAccount(eg.selfAccount.id, AccountsCompanion(
158+
await check(globalStore.updateAccount(eg.selfAccount.id, AccountsCompanion(
159159
realmUrl: Value(Uri.parse('https://other.example'))))).throws();
160-
check(globalStore.updateAccount(eg.selfAccount.id, const AccountsCompanion(
160+
await check(globalStore.updateAccount(eg.selfAccount.id, const AccountsCompanion(
161161
userId: Value(1234)))).throws();
162162
});
163163

0 commit comments

Comments
 (0)