code.gitea.io/gitea@v1.21.7/web_src/js/utils/match.test.js (about)

     1  import {matchEmoji, matchMention} from './match.js';
     2  
     3  test('matchEmoji', () => {
     4    expect(matchEmoji('')).toEqual([
     5      '+1',
     6      '-1',
     7      '100',
     8      '1234',
     9      '1st_place_medal',
    10      '2nd_place_medal',
    11    ]);
    12  
    13    expect(matchEmoji('hea')).toEqual([
    14      'headphones',
    15      'headstone',
    16      'health_worker',
    17      'hear_no_evil',
    18      'heard_mcdonald_islands',
    19      'heart',
    20    ]);
    21  
    22    expect(matchEmoji('hear')).toEqual([
    23      'hear_no_evil',
    24      'heard_mcdonald_islands',
    25      'heart',
    26      'heart_decoration',
    27      'heart_eyes',
    28      'heart_eyes_cat',
    29    ]);
    30  
    31    expect(matchEmoji('poo')).toEqual([
    32      'poodle',
    33      'hankey',
    34      'spoon',
    35      'bowl_with_spoon',
    36    ]);
    37  
    38    expect(matchEmoji('1st_')).toEqual([
    39      '1st_place_medal',
    40    ]);
    41  
    42    expect(matchEmoji('jellyfis')).toEqual([
    43      'jellyfish',
    44    ]);
    45  });
    46  
    47  test('matchMention', () => {
    48    expect(matchMention('')).toEqual(window.config.mentionValues.slice(0, 6));
    49    expect(matchMention('user4')).toEqual([window.config.mentionValues[3]]);
    50  });