Skip to content

Commit 37e643d

Browse files
committed
autocomplete test: Fix test that almost can't fail, of CombinedFeedNarrow
If for example one substitutes some other narrow like `topicNarrow` in this `checkResultsIn` call, the test still passes. That's because now the autocomplete does return results... but they don't match the arbitrary `expected` list that was passed in, so the inner `check` call fails, and the outer one succeeds because of that exception. Instead, check more specifically that the MentionAutocompleteView.init call throws.
1 parent bfce142 commit 37e643d

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

test/model/autocomplete_test.dart

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,13 @@ void main() {
565565
checkPrecedes(narrow, users[2], users.skip(3));
566566
}
567567
});
568+
569+
test('CombinedFeedNarrow gives error', () async {
570+
await prepare(users: [eg.user(), eg.user()], messages: []);
571+
const narrow = CombinedFeedNarrow();
572+
check(() => MentionAutocompleteView.init(store: store, narrow: narrow))
573+
.throws<AssertionError>();
574+
});
568575
});
569576

570577
group('autocomplete suggests relevant users in the intended order', () {
@@ -723,16 +730,6 @@ void main() {
723730
await checkResultsIn(dmNarrow, expected: [1, 3, 0, 2, 4]);
724731
});
725732
});
726-
727-
test('CombinedFeedNarrow', () async {
728-
await prepareStore();
729-
// As we do not expect a compose box in [CombinedFeedNarrow], it should
730-
// not proceed to show any results.
731-
await check(checkResultsIn(
732-
const CombinedFeedNarrow(),
733-
expected: [0, 1, 2, 3, 4])
734-
).throws();
735-
});
736733
});
737734
});
738735
}

0 commit comments

Comments
 (0)