Changeset View
Changeset View
Standalone View
Standalone View
lib/shared/emojis.test.js
// @flow | // @flow | ||||
import { defaultEmojiAvatars } from './avatar-utils.js'; | |||||
import { onlyOneEmojiRegex } from './emojis.js'; | import { onlyOneEmojiRegex } from './emojis.js'; | ||||
describe('onlyOneEmojiRegex', () => { | describe('onlyOneEmojiRegex', () => { | ||||
it('should match for (π)', () => { | it('should match for (π)', () => { | ||||
expect('π').toMatch(onlyOneEmojiRegex); | expect('π').toMatch(onlyOneEmojiRegex); | ||||
}); | }); | ||||
it('should match for (π«‘)', () => { | it('should match for (π«‘)', () => { | ||||
expect('π«‘').toMatch(onlyOneEmojiRegex); | expect('π«‘').toMatch(onlyOneEmojiRegex); | ||||
}); | }); | ||||
it('should match for (π¦ΆπΎ)', () => { | it('should match for (π¦ΆπΎ)', () => { | ||||
expect('π¦ΆπΎ').toMatch(onlyOneEmojiRegex); | expect('π¦ΆπΎ').toMatch(onlyOneEmojiRegex); | ||||
}); | }); | ||||
it('should not match for (π¦ΆπΎπ)', () => { | it('should not match for (π¦ΆπΎπ)', () => { | ||||
expect('π¦ΆπΎπ').not.toMatch(onlyOneEmojiRegex); | expect('π¦ΆπΎπ').not.toMatch(onlyOneEmojiRegex); | ||||
}); | }); | ||||
it('should not match for (that is π₯)', () => { | it('should not match for (that is π₯)', () => { | ||||
expect('that is π₯').not.toMatch(onlyOneEmojiRegex); | expect('that is π₯').not.toMatch(onlyOneEmojiRegex); | ||||
}); | }); | ||||
it('should match all defaultEmojiAvatars', () => { | |||||
for (const emojiAvatar of defaultEmojiAvatars) { | |||||
const { emoji } = emojiAvatar; | |||||
expect(emoji).toMatch(onlyOneEmojiRegex); | |||||
} | |||||
}); | |||||
it('should not match when U+FE0F suffixed', () => { | |||||
// See D8145 for more context | |||||
expect('βοΈ').not.toMatch(onlyOneEmojiRegex); | |||||
}); | |||||
}); | }); |