Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions apps/meteor/tests/unit/app/emoji/emojioneBaseline.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { expect } from 'chai';
import { describe, it } from 'mocha';
import emojione from 'emojione';

Check failure on line 3 in apps/meteor/tests/unit/app/emoji/emojioneBaseline.spec.ts

View workflow job for this annotation

GitHub Actions / 🔎 Code Check / Code Lint

`emojione` import should occur before import of `mocha`

import { getEmojiConfig } from '../../../../app/emoji-emojione/lib/getEmojiConfig';

// Baseline for the native-emoji migration: these assertions document behavior 8.6 users rely on.
// The counterpart PR against release-8.7.0 carries the same expectations as (currently failing)
// tests over the new emoji-native implementation.
describe('emojione baseline (pre-native-migration behavior)', () => {
describe('shortnameToUnicode', () => {
const cases: [string, string][] = [
[':red_haired:', '🦰'],
[':curly_haired:', '🦱'],
[':bald:', '🦲'],
[':white_haired:', '🦳'],
[':iphone:', '📱'],
];

cases.forEach(([shortname, unicode]) => {
it(`converts ${shortname}`, () => {
expect(emojione.shortnameToUnicode(shortname)).to.equal(unicode);
});
});

it('converts a shortcode that directly follows an unknown :token:', () => {
expect(emojione.shortnameToUnicode('12:30:fire:')).to.equal('12:30🔥');
});

it('renders the hand-patched legacy shortcodes in messages', () => {
// shortnameToUnicode drops the U+20E3 combiner for these hand-patched entries even on 8.6;
// the message path users actually saw went through render (emojione.toImage)
const html = getEmojiConfig().render(':digit_one:');
expect(html).to.be.a('string');
expect(html).to.include('digit_one');
});
});

describe('toShort', () => {
it('maps bare (unqualified) text-presentation emojis to shortnames', () => {
expect(emojione.toShort('❤')).to.equal(':heart:');
expect(emojione.toShort('☺')).to.equal(':relaxed:');
});
});

describe('picker rendering', () => {
it('renders the hand-patched legacy shortcodes', () => {
const image = getEmojiConfig().renderPicker(':digit_one:');
expect(image).to.be.a('string');
expect(image).to.include('digit_one');
});
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import emojione from 'emoji-toolkit';

// Baseline for the native-emoji migration: the transcript's unicode -> shortname conversion
// (EmojiSpan) uses emoji-toolkit, whose vocabulary matches the app emoji list. The counterpart
// PR against release-8.7.0 carries the same expectations over the new emojibase-based module.
describe('emoji-toolkit shortname vocabulary (pre-native-migration baseline)', () => {
it('names 👍 :thumbsup:', () => {
expect(emojione.toShort('\u{1F44D}')).toBe(':thumbsup:');
});

it('names 😃 :smiley:', () => {
expect(emojione.toShort('😃')).toBe(':smiley:');
});
});
Loading