|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 2 weeks ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
868 bytes
|
| Line | |
|---|
| 1 | import test from 'tape';
|
|---|
| 2 |
|
|---|
| 3 | import getSuggestion from '../../../src/util/getSuggestion';
|
|---|
| 4 |
|
|---|
| 5 | test('spell check suggestion API', (t) => {
|
|---|
| 6 | t.deepEqual([], getSuggestion('foo'), 'returns no suggestions given empty word and no dictionary');
|
|---|
| 7 |
|
|---|
| 8 | t.deepEqual(
|
|---|
| 9 | getSuggestion('foo'),
|
|---|
| 10 | [],
|
|---|
| 11 | 'returns no suggestions given real word and no dictionary',
|
|---|
| 12 | );
|
|---|
| 13 |
|
|---|
| 14 | t.deepEqual(
|
|---|
| 15 | getSuggestion('fo', ['foo', 'bar', 'baz']),
|
|---|
| 16 | ['foo'],
|
|---|
| 17 | 'returns correct suggestion given real word and a dictionary',
|
|---|
| 18 | );
|
|---|
| 19 |
|
|---|
| 20 | t.deepEqual(
|
|---|
| 21 | getSuggestion('theer', ['there', 'their', 'foo', 'bar']),
|
|---|
| 22 | ['there', 'their'],
|
|---|
| 23 | 'returns multiple correct suggestions given real word and a dictionary',
|
|---|
| 24 | );
|
|---|
| 25 |
|
|---|
| 26 | t.deepEqual(
|
|---|
| 27 | getSuggestion('theer', ['there', 'their', 'foo', 'bar'], 1),
|
|---|
| 28 | ['there'],
|
|---|
| 29 | 'returns correct # of suggestions given the limit argument',
|
|---|
| 30 | );
|
|---|
| 31 |
|
|---|
| 32 | t.end();
|
|---|
| 33 | });
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.