Skip to content

Commit a4565fd

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 031e806 commit a4565fd

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
@@ -155,11 +155,11 @@ void main() {
155155

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

0 commit comments

Comments
 (0)