Mirror of https://github.com/roostorg/coop
github.com/roostorg/coop
1import { stripEmojis } from './string.js';
2
3describe('String Helpers', () => {
4 describe('stripEmojis', () => {
5 test('should strip all emojis', () => {
6 const emojiList =
7 '😀😃😄😁😆😅😂🤣🥲🥹☺️😊😇🙂🙃😉😌😍🥰😘😗😙😚😋😛😝😜🤪🤨🧐🤓😎🥸🤩🥳😏😒😞😔😟😕🙁☹️😣😖😫😩🥺😢😭😮💨😤😠😡🤬🤯😳🥵🥶😱😨😰😥😓🫣🤗🫡🤔🫢🤭🤫🤥😶😶🌫️😐😑😬🫠🙄😯😦😧😮😲🥱😴🤤😪😵😵💫🫥🤐🥴🤢🤮🤧😷🤒🤕🤑🤠😈👿👹👺🤡💩👻💀☠️👽👾🤖🎃😺😸😹😻😼😽🙀😿😾🫠🫢🫣🫡🫥🫤🥹🫱🫱🏻🫱🏼🫱🏽🫱🏾🫱🏿🫲🫲🏻🫲🏼🫲🏽🫲🏾🫲🏿🫳🫳🏻🫳🏼🫳🏽🫳🏾🫳🏿🫴🫴🏻🫴🏼🫴🏽🫴🏾🫴🏿🫰🫰🏻🫰🏼🫰🏽🫰🏾🫰🏿🫵🫵🏻🫵🏼🫵🏽🫵🏾🫵🏿🫶🫶🏻🫶🏼🫶🏽🫶🏾🫶🏿🤝🏻🤝🏼🤝🏽🤝🏾🤝🏿🫱🏻🫲🏼🫱🏻🫲🏽🫱🏻🫲🏾🫱🏻🫲🏿🫱🏼🫲🏻🫱🏼🫲🏽🫱🏼🫲🏾🫱🏼🫲🏿🫱🏽🫲🏻🫱🏽🫲🏼🫱🏽🫲🏾🫱🏽🫲🏿🫱🏾🫲🏻🫱🏾🫲🏼🫱🏾🫲🏽🫱🏾🫲🏿🫱🏿🫲🏻🫱🏿🫲🏼🫱🏿🫲🏽🫱🏿🫲🏾🫦🫅🫅🏻🫅🏼🫅🏽🫅🏾🫅🏿🫃🫃🏻🫃🏼🫃🏽🫃🏾🫃🏿🫄🫄🏻🫄🏼🫄🏽🫄🏾🫄🏿🧌🪸🪷🪹🪺🫘🫗🫙🛝🛞🛟🪬🪩🪫🩼🩻🫧🪪🟰🏳️🏴🏁🚩🏳️🌈🏳️⚧️🏴☠️🇦🇫🇦🇽🇦🇱🇩🇿🇦🇸🇦🇩🇦🇴🇦🇮🇦🇶🇦🇬🇦🇷🇦🇲🇦🇼🇦🇺🇦🇹🇦🇿🇧🇸🇧🇭🇧🇩🇧🇧🇧🇾🇧🇪🇧🇿🇧🇯🇧🇲🇧🇹🇧🇴🇧🇦🇧🇼🇧🇷🇮🇴🇻🇬🇧🇳🇧🇬🇧🇫🇧🇮🇰🇭🇨🇲🇨🇦🇮🇨🇨🇻🇧🇶🇰🇾🇨🇫🇹🇩🇨🇱🇨🇳🇨🇽🇨🇨🇨🇴🇰🇲🇨🇬🇨🇩🇨🇰🇨🇷🇨🇮🇭🇷🇨🇺🇨🇼🇨🇾🇨🇿🇩🇰🇩🇯🇩🇲🇩🇴🇪🇨🇪🇬🇸🇻🇬🇶🇪🇷🇪🇪🇪🇹🇪🇺🇫🇰🇫🇴🇫🇯🇫🇮🇫🇷🇬🇫🇵🇫🇹🇫🇬🇦🇬🇲🇬🇪🇩🇪🇬🇭🇬🇮🇬🇷🇬🇱🇬🇩🇬🇵🇬🇺🇬🇹🇬🇬🇬🇳🇬🇼🇬🇾🇭🇹🇭🇳🇭🇰🇭🇺🇮🇸🇮🇳🇮🇩🇮🇷🇮🇶🇮🇪🇮🇲🇮🇱🇮🇹🇯🇲🇯🇵🎌🇯🇪🇯🇴🇰🇿🇰🇪🇰🇮🇽🇰🇰🇼🇰🇬🇱🇦🇱🇻🇱🇧🇱🇸🇱🇷🇱🇾🇱🇮🇱🇹🇱🇺🇲🇴🇲🇰🇲🇬🇲🇼🇲🇾🇲🇻🇲🇱🇲🇹🇲🇭🇲🇶🇲🇷🇲🇺🇾🇹🇲🇽🇫🇲🇲🇩🇲🇨🇲🇳🇲🇪🇲🇸🇲🇦🇲🇿🇲🇲🇳🇦🇳🇷🇳🇵🇳🇱🇳🇨🇳🇿🇳🇮🇳🇪🇳🇬🇳🇺🇳🇫🇰🇵🇲🇵🇳🇴🇴🇲🇵🇰🇵🇼🇵🇸🇵🇦🇵🇬🇵🇾🇵🇪🇵🇭🇵🇳🇵🇱🇵🇹🇵🇷🇶🇦🇷🇪🇷🇴🇷🇺🇷🇼🇼🇸🇸🇲🇸🇦🇸🇳🇷🇸🇸🇨🇸🇱🇸🇬🇸🇽🇸🇰🇸🇮🇬🇸🇸🇧🇸🇴🇿🇦🇰🇷🇸🇸🇪🇸🇱🇰🇧🇱🇸🇭🇰🇳🇱🇨🇵🇲🇻🇨🇸🇩🇸🇷🇸🇿🇸🇪🇨🇭🇸🇾🇹🇼🇹🇯🇹🇿🇹🇭🇹🇱🇹🇬🇹🇰🇹🇴🇹🇹🇹🇳🇹🇷🇹🇲🇹🇨🇹🇻🇻🇮🇺🇬🇺🇦🇦🇪🇬🇧🏴🏴🏴🇺🇳🇺🇸🇺🇾🇺🇿🇻🇺🇻🇦🇻🇪🇻🇳🇼🇫🇪🇭🇾🇪🇿🇲🇿🇼';
8 expect(stripEmojis(emojiList)).toEqual('');
9 });
10 test('should not strip normal characters', () => {
11 const test =
12 'abcdefghijklmnopqrstuvwxyz123456789~!@#$%^&*()àèìòùÀÈÌÒÙæÆß漢字';
13 expect(stripEmojis(test)).toEqual(
14 `abcdefghijklmnopqrstuvwxyz123456789~!@#$%^&*()àèìòùÀÈÌÒÙæÆß漢字`,
15 );
16 });
17 test('should not strip normal characters', () => {
18 const test =
19 'abcdefghijklmnop😃😄😁😆😅😂🤣🥲🥹☺️😊😇🙂qrstuvwxyz123456789~!@#$%^&🥸🤩🥳😏😒😞😔😟😕🙁☹️😣😖😫😩*()àèìòùÀÈÌ🤤😪😵😵💫🫥🤐🥴🤢🤮🤧😷🤒ÒÙæÆß漢字';
20 expect(stripEmojis(test)).toEqual(
21 `abcdefghijklmnopqrstuvwxyz123456789~!@#$%^&*()àèìòùÀÈÌÒÙæÆß漢字`,
22 );
23 });
24 });
25});