Skip to content

Commit f6e7e3c

Browse files
committed
autocomplete test: Fix not-starve test, using awaitFakeAsync
Using just `fakeAsync`, when this hit an `await` it just stopped and didn't finish the remainder of the test, so didn't get to the point of testing what it's meant to test. I believe the test worked correctly when first committed, as it had no `await` of its own; but later was accidentally defeated by eca33f9 introducing an `await` for `store.addUsers`. Using our `awaitFakeAsync` fixes the problem. This was the only call to `fakeAsync` in our codebase, so I believe this commit fixes the whole problem.
1 parent 85b9c43 commit f6e7e3c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/model/autocomplete_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import 'dart:async';
22
import 'dart:convert';
33

44
import 'package:checks/checks.dart';
5-
import 'package:fake_async/fake_async.dart';
65
import 'package:flutter/widgets.dart';
76
import 'package:test/scaffolding.dart';
87
import 'package:zulip/api/model/initial_snapshot.dart';
@@ -15,6 +14,7 @@ import 'package:zulip/widgets/compose_box.dart';
1514

1615
import '../api/fake_api.dart';
1716
import '../example_data.dart' as eg;
17+
import '../fake_async.dart';
1818
import 'test_store.dart';
1919
import 'autocomplete_checks.dart';
2020

@@ -189,7 +189,7 @@ void main() {
189189
});
190190

191191
test('MentionAutocompleteView not starve timers', () {
192-
fakeAsync((binding) async {
192+
return awaitFakeAsync((binding) async {
193193
const narrow = ChannelNarrow(1);
194194
final store = eg.store();
195195
await store.addUsers([eg.selfUser, eg.otherUser, eg.thirdUser]);

0 commit comments

Comments
 (0)