Skip to content

Commit 071af40

Browse files
committed
autocomplete test [nfc]: Use plain strings for finding topic
instead of inferring it from a TopicName Signed-off-by: Zixuan James Li <[email protected]>
1 parent 9216e20 commit 071af40

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
@@ -334,8 +334,8 @@ void main() {
334334
});
335335

336336
group('TopicAutocomplete', () {
337-
void checkTopicShown(GetStreamTopicsEntry topic, PerAccountStore store, {required bool expected}) {
338-
check(find.text(topic.name.displayName).evaluate().length).equals(expected ? 1 : 0);
337+
void checkTopicShown(String topic, PerAccountStore store, {required bool expected}) {
338+
check(find.text(topic).evaluate().length).equals(expected ? 1 : 0);
339339
}
340340

341341
testWidgets('options appear, disappear, and change correctly', (WidgetTester tester) async {
@@ -352,24 +352,24 @@ void main() {
352352
await tester.pumpAndSettle();
353353

354354
// "topic three" and "topic two" appear, but not "topic one"
355-
checkTopicShown(topic1, store, expected: false);
356-
checkTopicShown(topic2, store, expected: true);
357-
checkTopicShown(topic3, store, expected: true);
355+
checkTopicShown('Topic one', store, expected: false);
356+
checkTopicShown('Topic two', store, expected: true);
357+
checkTopicShown('Topic three', store, expected: true);
358358

359359
// Finishing autocomplete updates topic box; causes options to disappear
360360
await tester.tap(find.text('Topic three'));
361361
await tester.pumpAndSettle();
362362
check(tester.widget<TextField>(topicInputFinder).controller!.text)
363363
.equals(topic3.name.displayName);
364-
checkTopicShown(topic1, store, expected: false);
365-
checkTopicShown(topic2, store, expected: false);
366-
checkTopicShown(topic3, store, expected: true); // shown in `_TopicInput` once
364+
checkTopicShown('Topic one', store, expected: false);
365+
checkTopicShown('Topic two', store, expected: false);
366+
checkTopicShown('Topic three', store, expected: true); // shown in `_TopicInput` once
367367

368368
// Then a new autocomplete intent brings up options again
369369
await tester.enterText(topicInputFinder, 'Topic');
370370
await tester.enterText(topicInputFinder, 'Topic T');
371371
await tester.pumpAndSettle();
372-
checkTopicShown(topic2, store, expected: true);
372+
checkTopicShown('Topic two', store, expected: true);
373373
});
374374

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

0 commit comments

Comments
 (0)