Skip to content

Commit 7efc53c

Browse files
committed
api test [nfc]: Use finish helper for async checks
This explicitly ensures that these checks complete before the test ends. We can keep these single-line helper calls without adding `await`'s to all of them. Signed-off-by: Zixuan James Li <[email protected]>
1 parent 500a8ae commit 7efc53c

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

test/api/core_test.dart

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,19 @@ void main() {
6464
});
6565

6666
test('send rejects off-realm URL (with default useAuth)', () async {
67-
Future<void> checkAllow(String realmUrl, String requestUrl) async {
68-
check(await makeRequest(realmUrl, requestUrl))
69-
.isA<http.Request>()
70-
.url.asString.equals(requestUrl);
67+
void checkAllow(String realmUrl, String requestUrl) {
68+
finish(() async {
69+
check(await makeRequest(realmUrl, requestUrl))
70+
.isA<http.Request>()
71+
.url.asString.equals(requestUrl);
72+
}());
7173
}
7274

73-
Future<void> checkDeny(String realmUrl, String requestUrl) async {
74-
await check(makeRequest(realmUrl, requestUrl))
75-
.throws<StateError>();
75+
void checkDeny(String realmUrl, String requestUrl) async {
76+
finish(() async {
77+
await check(makeRequest(realmUrl, requestUrl))
78+
.throws<StateError>();
79+
}());
7680
}
7781

7882
// Baseline: normal requests are allowed.

0 commit comments

Comments
 (0)