-
Notifications
You must be signed in to change notification settings - Fork 4
/
test.js
51 lines (44 loc) · 927 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
var test = require('tape')
var morph = require('.')
test('levenmorpher', function(t) {
t.deepEqual(
morph('order', 'chaos'),
['order', 'corder', 'coder', 'codes', 'cades', 'cads', 'chads', 'chaos'],
'returns an array of words from a to b'
)
t.deepEqual(morph('same', 'same'), ['same'], 'should support same two words')
t.deepEqual(
morph('funny', 'phoney'),
['funny', 'punny', 'penny', 'peony', 'phony', 'phoney'],
'(#2)'
)
t.deepEqual(
morph('black', 'white'),
[
'black',
'alack',
'aback',
'abac',
'aba',
'aha',
'ahi',
'ahis',
'chis',
'chit',
'whit',
'white'
],
'(#3)'
)
t.deepEqual(
morph('ruby', 'node'),
['ruby', 'rube', 'robe', 'rode', 'node'],
'(#4)'
)
t.equal(
morph('osldjfds', 'askdjfdsfds'),
null,
'returns null when it cannot complete'
)
t.end()
})