diff --git a/test/spec/database/Database.test.js b/test/spec/database/Database.test.js index 69e3d009..7358497a 100644 --- a/test/spec/database/Database.test.js +++ b/test/spec/database/Database.test.js @@ -218,8 +218,9 @@ describe('database tests', () => { expect(thumbsUp[0].skins[0].unicode).toBeTruthy() expect(thumbsUp[0].skins[0].version).toBeTruthy() expect(thumbsUp[0].shortcodes).toContain('thumbsup') - const grinningFace = await db.getEmojiBySearchQuery('grinning face with smiling eyes') - expect(grinningFace[0].emoticon).toEqual(':D') + const grinningFace = (await db.getEmojiBySearchQuery('grinning face with smiling eyes')) + .find(_ => _.unicode === '😄') + expect(grinningFace.emoticon).toEqual(':D') await db.delete() }) diff --git a/test/spec/database/custom.test.js b/test/spec/database/custom.test.js index 0e5adcf8..ced065fa 100644 --- a/test/spec/database/custom.test.js +++ b/test/spec/database/custom.test.js @@ -108,7 +108,8 @@ describe('custom emoji', () => { expect((await db.getEmojiBySearchQuery('monkey')).map(summarize)).toStrictEqual([ { name: 'monkey', shortcodes: ['monkey'], url: 'monkey.png' }, summaryByUnicode('🐵'), - summaryByUnicode('🐒') + summaryByUnicode('🐒'), + summaryByUnicode('🦧') ]) expect((await db.getEmojiBySearchQuery('undersc'))).toStrictEqual([ diff --git a/test/spec/database/getEmojiBySearchQuery.test.js b/test/spec/database/getEmojiBySearchQuery.test.js index d4713ac1..1b3b396d 100644 --- a/test/spec/database/getEmojiBySearchQuery.test.js +++ b/test/spec/database/getEmojiBySearchQuery.test.js @@ -53,25 +53,29 @@ describe('getEmojiBySearchQuery', () => { expectToBeSorted(results) expect(results.map(_ => omit(_, ['order']))).toStrictEqual([ { annotation: 'monkey face' }, - { annotation: 'monkey' } + { annotation: 'monkey' }, + { annotation: 'orangutan' } ]) results = await search('monkey') expectToBeSorted(results) expect(results.map(_ => omit(_, ['order']))).toStrictEqual([ { annotation: 'monkey face' }, - { annotation: 'monkey' } + { annotation: 'monkey' }, + { annotation: 'orangutan' } ]) results = await search('monkey') expectToBeSorted(results) expect(results.map(_ => omit(_, ['order']))).toStrictEqual([ { annotation: 'monkey face' }, - { annotation: 'monkey' } + { annotation: 'monkey' }, + { annotation: 'orangutan' } ]) results = await search('MoNkEy') expectToBeSorted(results) expect(results.map(_ => omit(_, ['order']))).toStrictEqual([ { annotation: 'monkey face' }, - { annotation: 'monkey' } + { annotation: 'monkey' }, + { annotation: 'orangutan' } ]) results = await search('monkey fac') expect(results.map(_ => omit(_, ['order']))).toStrictEqual([ diff --git a/test/spec/picker/Picker.test.js b/test/spec/picker/Picker.test.js index e971ca6b..ca900f37 100644 --- a/test/spec/picker/Picker.test.js +++ b/test/spec/picker/Picker.test.js @@ -71,10 +71,11 @@ describe('Picker tests', () => { expect(queryAllByRole('tab', { selected: true })).toHaveLength(1) // one tab selected at first await type(getByRole('combobox'), 'monk') - await waitFor(() => expect(getAllByRole('option')).toHaveLength(2)) + await waitFor(() => expect(getAllByRole('option')).toHaveLength(3)) expect(getByRole('option', { name: /🐵/ })).toBeVisible() expect(getByRole('option', { name: /🐒/ })).toBeVisible() + expect(getByRole('option', { name: /🦧/ })).toBeVisible() expect(queryAllByRole('tab', { selected: true })).toHaveLength(0) // no tabs selected when searching }) @@ -242,7 +243,20 @@ describe('Picker tests', () => { annotation: 'grinning face', group: 0, shortcodes: ['grinning', 'grinning_face'], - tags: ['face', 'grin'], + tags: [ + 'cheerful', + 'cheery', + 'face', + 'grin', + 'grinning', + 'happy', + 'laugh', + 'nice', + 'smile', + 'smiling', + 'teeth' + + ], unicode: '😀', version: 1 }, @@ -265,7 +279,7 @@ describe('Picker tests', () => { annotation: 'thumbs up', group: 1, shortcodes: ['+1', 'thumbsup', 'yes'], - tags: ['+1', 'hand', 'thumb', 'up'], + tags: ['+1', 'good', 'hand', 'like', 'thumb', 'up', 'yes'], unicode: '👍️', version: 0.6, skins: [ @@ -289,7 +303,19 @@ describe('Picker tests', () => { annotation: 'grinning face', group: 0, shortcodes: ['grinning', 'grinning_face'], - tags: ['face', 'grin'], + tags: [ + 'cheerful', + 'cheery', + 'face', + 'grin', + 'grinning', + 'happy', + 'laugh', + 'nice', + 'smile', + 'smiling', + 'teeth' + ], unicode: '😀', version: 1 }, @@ -300,7 +326,7 @@ describe('Picker tests', () => { test('press up/down on search input', async () => { type(getByRole('combobox'), 'monk') - await waitFor(() => expect(getAllByRole('option')).toHaveLength(2)) + await waitFor(() => expect(getAllByRole('option')).toHaveLength(3)) const pressKeyAndExpectAriaDescendant = async (key, emoji) => { await new Promise(resolve => requestAnimationFrame(() => requestAnimationFrame(resolve))) // delay @@ -313,8 +339,12 @@ describe('Picker tests', () => { await pressKeyAndExpectAriaDescendant('ArrowDown', '🐵') await pressKeyAndExpectAriaDescendant('ArrowDown', '🐒') - await pressKeyAndExpectAriaDescendant('ArrowUp', '🐵') + await pressKeyAndExpectAriaDescendant('ArrowDown', '🦧') + await pressKeyAndExpectAriaDescendant('ArrowDown', '🐵') + await pressKeyAndExpectAriaDescendant('ArrowUp', '🦧') await pressKeyAndExpectAriaDescendant('ArrowUp', '🐒') + await pressKeyAndExpectAriaDescendant('ArrowUp', '🐵') + await pressKeyAndExpectAriaDescendant('ArrowDown', '🐒') let emoji picker.addEventListener('emoji-click', event => { @@ -327,7 +357,7 @@ describe('Picker tests', () => { annotation: 'monkey', group: 3, shortcodes: ['monkey'], - tags: ['monkey'], + tags: ['animal', 'banana'], unicode: '🐒', version: 0.6 }, diff --git a/test/spec/picker/favorites.test.js b/test/spec/picker/favorites.test.js index 579c7ea0..edf6514d 100644 --- a/test/spec/picker/favorites.test.js +++ b/test/spec/picker/favorites.test.js @@ -136,7 +136,7 @@ describe('Favorites UI', () => { test('press down on search input - does not affect favorites', async () => { type(getByRole(container, 'combobox'), 'monk') - await waitFor(() => expect(getAllByRole(container, 'option')).toHaveLength(2)) + await waitFor(() => expect(getAllByRole(container, 'option')).toHaveLength(3)) const pressKeyAndExpectAriaDescendant = async (key, emoji) => { await new Promise(resolve => requestAnimationFrame(() => requestAnimationFrame(resolve))) // delay diff --git a/test/spec/picker/scrolling.test.js b/test/spec/picker/scrolling.test.js index 02fffc82..d19ea138 100644 --- a/test/spec/picker/scrolling.test.js +++ b/test/spec/picker/scrolling.test.js @@ -69,7 +69,7 @@ describe('scrolling', () => { await userEvent.type(getByRole(container, 'combobox'), 'monkey') - await waitFor(() => expect(getAllByRole(container, 'option')).toHaveLength(2)) + await waitFor(() => expect(getAllByRole(container, 'option')).toHaveLength(3)) expect(getByRole(container, 'option', { name: /🐵/ })).toBeVisible() await tick(100)