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 committed Dec 8, 2024
1 parent 0292bdf commit 327efa2
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 @@ -127,11 +127,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 @@ -170,10 +170,10 @@ void main() {
]);

store.setServerEmojiData(ServerEmojiData(codeToNames: {
'1f642': ['smile'],
'1f516': ['bookmark'],
}));
check(store.allEmojiCandidates()).deepEquals([
isUnicodeCandidate('1f642', ['smile']),
isUnicodeCandidate('1f516', ['bookmark']),
isZulipCandidate(),
]);
});
Expand All @@ -197,7 +197,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 @@ -237,15 +237,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 327efa2

Please sign in to comment.