<commit_before>import { getFilteredEmojiNames, nameToEmojiMap } from '../data';

// Prettier disabled in .prettierignore ; it misparses this file, apparently
// because of the emoji.  (Even if they're tucked away in comments, it still
// gets it wrong.)

/* eslint-disable dot-notation, spellcheck/spell-checker */
describe('nameToEmojiMap', () => {
  test('works for some single-codepoint emoji', () => {
    expect(nameToEmojiMap['thumbs_up']).toEqual('👍').toEqual('');
    expect(nameToEmojiMap['pride']).toEqual('🌈');
    expect(nameToEmojiMap['rainbow']).toEqual('🌈');
  });

  // Skipped because of (part of?) #3129.
  test.skip('works for some multi-codepoint emoji', () => {
    expect(nameToEmojiMap['0']).toEqual('0⃣');
    expect(nameToEmojiMap['asterisk']).toEqual('*⃣');
    expect(nameToEmojiMap['hash']).toEqual('#⃣');
  });
});

describe('getFilteredEmojiNames', () => {
  test('empty query returns all emojis', () => {
    const list = getFilteredEmojiNames('', {});
    expect(list).toHaveLength(1560);
  });

  test('non existing query returns empty list', () => {
    const list = getFilteredEmojiNames('qwerty', {});
    expect(list).toHaveLength(0);
  });

  test('returns a sorted list of emojis starting with query', () => {
    const list = getFilteredEmojiNames('go', {});
    expect(list).toEqual([
      'go',
      'goal',
      'goat',
      'goblin',
      'gold',
      'gold_record',
      'golf',
      'gondola',
      'goodnight',
      'gooooooooal',
      'gorilla',<commit_msg>emoji: Make those nameToEmojiMap tests more explicit in source.<commit_after>import { getFilteredEmojiNames, nameToEmojiMap } from '../data';

// Prettier disabled in .prettierignore ; it misparses this file, apparently
// because of the emoji.  (Even if they're tucked away in comments, it still
// gets it wrong.)

/* eslint-disable no-multi-spaces, spellcheck/spell-checker */
describe('nameToEmojiMap', () => {
  const check = (name, string1, string2) => {
    expect(string1).toEqual(string2);
    expect(nameToEmojiMap[name]).toEqual(string1);
  };

  test('works for some single-codepoint emoji', () => {
    check('thumbs_up', '👍', '\u{1f44d}');
    check('pride',     '🌈', '\u{1f308}');
    check('rainbow',   '🌈', '\u{1f308}');
  });

  // Skipped because of (part of?) #3129.
  test.skip('works for some multi-codepoint emoji', () => {
    check('0',        '0⃣', '0\u{20e3}');
    check('asterisk', '*⃣', '*\u{20e3}');
    check('hash',     '#⃣', '#\u{20e3}');
  });
});

describe('getFilteredEmojiNames', () => {
  test('empty query returns all emojis', () => {
    const list = getFilteredEmojiNames('', {});
    expect(list).toHaveLength(1560);
  });

  test('non existing query returns empty list', () => {
    const list = getFilteredEmojiNames('qwerty', {});
    expect(list).toHaveLength(0);
  });

  test('returns a sorted list of emojis starting with query', () => {
    const list = getFilteredEmojiNames('go', {});
    expect(list).toEqual([
      'go',
      'goal',
      'goat',
      'goblin',
      'gold',
      'gold_record',
      'golf',
      'gondola',
      'goodnight',
      'gooooooooal',
      'gorilla',
{'fraction_non_alphanumeric': 0.192465970243748, 'fraction_numerical': 0.015194681861348529, 'mean_word_length': 3.5467625899280577, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2865280', 'n_tokens_mistral': 1125, 'n_tokens_neox': 1129, 'n_words': 226}