Files
NapCatQQ/.pnpm-store/v3/files/c9/041863cac75a15fbe1c91f2c025820f8308d75d59afc5b22ac702aa4d54a69c2a0992d4ead2df310d3590229daf6fe9282e4de4654d56c193878ccfd0ba9f8
T
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

34 lines
868 B
Plaintext

import test from 'tape';
import getSuggestion from '../../../src/util/getSuggestion';
test('spell check suggestion API', (t) => {
t.deepEqual([], getSuggestion('foo'), 'returns no suggestions given empty word and no dictionary');
t.deepEqual(
getSuggestion('foo'),
[],
'returns no suggestions given real word and no dictionary',
);
t.deepEqual(
getSuggestion('fo', ['foo', 'bar', 'baz']),
['foo'],
'returns correct suggestion given real word and a dictionary',
);
t.deepEqual(
getSuggestion('theer', ['there', 'their', 'foo', 'bar']),
['there', 'their'],
'returns multiple correct suggestions given real word and a dictionary',
);
t.deepEqual(
getSuggestion('theer', ['there', 'their', 'foo', 'bar'], 1),
['there'],
'returns correct # of suggestions given the limit argument',
);
t.end();
});