Skip to content

Commit

Permalink
emoji test: Avoid coincidentally using "popular" emoji
Browse files Browse the repository at this point in the history
We'll soon (for zulip#1068) be adding logic that distinguishes these emoji
from other Unicode emoji.  That would break some test cases which
refer to an emoji that happens to be "popular", like 😄, when
they really just intend the generic behavior that happens to any
Unicode emoji.
  • Loading branch information
gnprice authored and shivanshsharma13 committed Dec 13, 2024
1 parent 3d05ccc commit 0a2c716
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions test/model/emoji_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,11 @@ void main() {
final store = prepare(realmEmoji: {
'1': eg.realmEmojiItem(emojiCode: '1', emojiName: 'smiley'),
}, unicodeEmoji: {
'1f642': ['smile'],
'1f516': ['bookmark'],
'1f603': ['smiley'],
});
check(store.allEmojiCandidates()).deepEquals([
isUnicodeCandidate('1f642', ['smile']),
isUnicodeCandidate('1f516', ['bookmark']),
isRealmCandidate(emojiCode: '1', emojiName: 'smiley'),
isZulipCandidate(),
]);
Expand Down Expand Up @@ -207,10 +207,10 @@ void main() {
]);

store.setServerEmojiData(ServerEmojiData(codeToNames: {
'1f642': ['smile'],
'1f516': ['bookmark'],
}));
check(store.allEmojiCandidates()).deepEquals([
isUnicodeCandidate('1f642', ['smile']),
isUnicodeCandidate('1f516', ['bookmark']),
isZulipCandidate(),
]);
});
Expand All @@ -234,7 +234,7 @@ void main() {
final store = prepare(realmEmoji: {
'1': eg.realmEmojiItem(emojiCode: '1', emojiName: 'happy'),
}, unicodeEmoji: {
'1f642': ['smile'],
'1f516': ['bookmark'],
});
final candidates = store.allEmojiCandidates();
check(store.allEmojiCandidates()).identicalTo(candidates);
Expand Down Expand Up @@ -274,15 +274,15 @@ void main() {

test('results can include all three emoji types', () async {
final store = prepare(
realmEmoji: {'1': 'happy'}, unicodeEmoji: {'1f642': ['smile']});
realmEmoji: {'1': 'happy'}, unicodeEmoji: {'1f516': ['bookmark']});
final view = EmojiAutocompleteView.init(store: store,
query: EmojiAutocompleteQuery(''));
bool done = false;
view.addListener(() { done = true; });
await Future(() {});
check(done).isTrue();
check(view.results).deepEquals([
isUnicodeResult(names: ['smile']),
isUnicodeResult(names: ['bookmark']),
isRealmResult(emojiName: 'happy'),
isZulipResult(),
]);
Expand Down

0 comments on commit 0a2c716

Please sign in to comment.