|
1 |
| -import { |
2 |
| - calculateLevenshteinDistance, |
3 |
| - getCloseMatchesByAttribute, |
4 |
| -} from '../close-matches' |
| 1 | +import {getCloseMatchesByAttribute} from '../close-matches' |
5 | 2 | import {render} from './helpers/test-utils'
|
6 | 3 |
|
7 |
| -describe('calculateLevenshteinDistance', () => { |
8 |
| - test.each([ |
9 |
| - ['', '', 0], |
10 |
| - ['hello', 'hello', 0], |
11 |
| - ['greeting', 'greeting', 0], |
12 |
| - ['react testing library', 'react testing library', 0], |
13 |
| - ['hello', 'hellow', 1], |
14 |
| - ['greetimg', 'greeting', 1], |
15 |
| - ['submit', 'sbmit', 1], |
16 |
| - ['cance', 'cancel', 1], |
17 |
| - ['doug', 'dog', 1], |
18 |
| - ['dogs and cats', 'dogs and cat', 1], |
19 |
| - ['uncool-div', '12cool-div', 2], |
20 |
| - ['dogs and cats', 'dogs, cats', 4], |
21 |
| - ['greeting', 'greetings traveler', 10], |
22 |
| - ['react testing library', '', 21], |
23 |
| - ['react testing library', 'y', 20], |
24 |
| - ['react testing library', 'ty', 19], |
25 |
| - ['react testing library', 'tary', 17], |
26 |
| - ['react testing library', 'trary', 16], |
27 |
| - ['react testing library', 'tlibrary', 13], |
28 |
| - ['react testing library', 'react testing', 8], |
29 |
| - ['library', 'testing', 7], |
30 |
| - ['react library', 'react testing', 7], |
31 |
| - [ |
32 |
| - 'The more your tests resemble the way your software is used, the more confidence they can give you.', |
33 |
| - 'The less your tests resemble the way your software is used, the less confidence they can give you.', |
34 |
| - 8, |
35 |
| - ], |
36 |
| - ])('distance between "%s" and "%s" is %i', (text1, text2, expected) => { |
37 |
| - expect(calculateLevenshteinDistance(text1, text2)).toBe(expected) |
38 |
| - }) |
39 |
| -}) |
40 |
| - |
41 | 4 | describe('getCloseMatchesByAttribute', () => {
|
42 | 5 | test('should return all closest matches', () => {
|
43 | 6 | const {container} = render(`
|
|
0 commit comments