mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-07-25 19:05:03 +02:00
* enhance(frontend/test): frontend e2eをVitest Browser Modeに移行
* fix
* fix unit tests
* fix
* fix
* update playwright
* fix
* fix
* fix
* fix
* fix
* fix
* fix
* fix
* perf
* Revert "perf"
This reverts commit e60e965c3c.
* fix
35 lines
1.6 KiB
TypeScript
35 lines
1.6 KiB
TypeScript
/*
|
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
|
|
import { assert, describe, test } from 'vitest';
|
|
import { searchEmoji } from '@/utility/search-emoji.js';
|
|
|
|
describe('emoji autocomplete', () => {
|
|
test('名前の完全一致は名前の前方一致より優先される', async () => {
|
|
const result = searchEmoji('foooo', [{ emoji: ':foooo:', name: 'foooo' }, { emoji: ':foooobaaar:', name: 'foooobaaar' }]);
|
|
assert.equal(result[0].emoji, ':foooo:');
|
|
});
|
|
|
|
test('名前の前方一致は名前の部分一致より優先される', async () => {
|
|
const result = searchEmoji('baaa', [{ emoji: ':baaar:', name: 'baaar' }, { emoji: ':foooobaaar:', name: 'foooobaaar' }]);
|
|
assert.equal(result[0].emoji, ':baaar:');
|
|
});
|
|
|
|
test('名前の完全一致はタグの完全一致より優先される', async () => {
|
|
const result = searchEmoji('foooo', [{ emoji: ':foooo:', name: 'foooo' }, { emoji: ':baaar:', name: 'foooo', aliasOf: 'baaar' }]);
|
|
assert.equal(result[0].emoji, ':foooo:');
|
|
});
|
|
|
|
test('名前の前方一致はタグの前方一致より優先される', async () => {
|
|
const result = searchEmoji('foo', [{ emoji: ':foooo:', name: 'foooo' }, { emoji: ':baaar:', name: 'foooo', aliasOf: 'baaar' }]);
|
|
assert.equal(result[0].emoji, ':foooo:');
|
|
});
|
|
|
|
test('名前の部分一致はタグの部分一致より優先される', async () => {
|
|
const result = searchEmoji('oooo', [{ emoji: ':foooo:', name: 'foooo' }, { emoji: ':baaar:', name: 'foooo', aliasOf: 'baaar' }]);
|
|
assert.equal(result[0].emoji, ':foooo:');
|
|
});
|
|
});
|