hardlounge/test/client/js/helpers/ircmessageparser/findEmoji.ts

65 lines
1.3 KiB
TypeScript
Raw Permalink Normal View History

import {expect} from "chai";
import findEmoji from "../../../../../client/js/helpers/ircmessageparser/findEmoji";
2017-08-23 14:34:20 +00:00
describe("findEmoji", () => {
it("should find default emoji presentation character", () => {
const input = "test \u{231A} test";
2019-07-17 09:33:59 +00:00
const expected = [
{
start: 5,
end: 6,
emoji: "\u{231A}",
},
];
2017-08-23 14:34:20 +00:00
const actual = findEmoji(input);
expect(actual).to.deep.equal(expected);
});
it("should find default text presentation character rendered as emoji", () => {
const input = "test \u{2194}\u{FE0F} test";
2019-07-17 09:33:59 +00:00
const expected = [
{
start: 5,
end: 7,
emoji: "\u{2194}\u{FE0F}",
},
];
2017-08-23 14:34:20 +00:00
const actual = findEmoji(input);
expect(actual).to.deep.equal(expected);
});
it("should find emoji modifier base", () => {
const input = "test\u{1F469}test";
2019-07-17 09:33:59 +00:00
const expected = [
{
start: 4,
end: 6,
emoji: "\u{1F469}",
},
];
2017-08-23 14:34:20 +00:00
const actual = findEmoji(input);
expect(actual).to.deep.equal(expected);
});
it("should find emoji modifier base followed by a modifier", () => {
const input = "test\u{1F469}\u{1F3FF}test";
2019-07-17 09:33:59 +00:00
const expected = [
{
start: 4,
end: 8,
emoji: "\u{1F469}\u{1F3FF}",
},
];
2017-08-23 14:34:20 +00:00
const actual = findEmoji(input);
expect(actual).to.deep.equal(expected);
});
});