Skip to content

Commit 9bcaf0b

Browse files
committed
autocomplete test [nfc]: Use plain strings for finding topic
instead of reading TopicName.displayName Signed-off-by: Zixuan James Li <[email protected]>
1 parent 151127a commit 9bcaf0b

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

test/widgets/autocomplete_test.dart

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -392,8 +392,8 @@ void main() {
392392
});
393393

394394
group('TopicAutocomplete', () {
395-
void checkTopicShown(GetStreamTopicsEntry topic, PerAccountStore store, {required bool expected}) {
396-
check(find.text(topic.name.displayName).evaluate().length).equals(expected ? 1 : 0);
395+
void checkTopicShown(String topic, PerAccountStore store, {required bool expected}) {
396+
check(find.text(topic).evaluate().length).equals(expected ? 1 : 0);
397397
}
398398

399399
testWidgets('options appear, disappear, and change correctly', (WidgetTester tester) async {
@@ -410,24 +410,24 @@ void main() {
410410
await tester.pumpAndSettle();
411411

412412
// "topic three" and "topic two" appear, but not "topic one"
413-
checkTopicShown(topic1, store, expected: false);
414-
checkTopicShown(topic2, store, expected: true);
415-
checkTopicShown(topic3, store, expected: true);
413+
checkTopicShown('Topic one', store, expected: false);
414+
checkTopicShown('Topic two', store, expected: true);
415+
checkTopicShown('Topic three', store, expected: true);
416416

417417
// Finishing autocomplete updates topic box; causes options to disappear
418418
await tester.tap(find.text('Topic three'));
419419
await tester.pumpAndSettle();
420420
check(tester.widget<TextField>(topicInputFinder).controller!.text)
421421
.equals(topic3.name.displayName);
422-
checkTopicShown(topic1, store, expected: false);
423-
checkTopicShown(topic2, store, expected: false);
424-
checkTopicShown(topic3, store, expected: true); // shown in `_TopicInput` once
422+
checkTopicShown('Topic one', store, expected: false);
423+
checkTopicShown('Topic two', store, expected: false);
424+
checkTopicShown('Topic three', store, expected: true); // shown in `_TopicInput` once
425425

426426
// Then a new autocomplete intent brings up options again
427427
await tester.enterText(topicInputFinder, 'Topic');
428428
await tester.enterText(topicInputFinder, 'Topic T');
429429
await tester.pumpAndSettle();
430-
checkTopicShown(topic2, store, expected: true);
430+
checkTopicShown('Topic two', store, expected: true);
431431
});
432432

433433
testWidgets('text selection is reset on choosing an option', (tester) async {

0 commit comments

Comments
 (0)