1
- const totalWordsInTrie = require ( './index' )
2
- const Trie = require ( '../index' ) ;
3
1
const assert = require ( 'assert' ) ;
2
+ const totalWordsInTrie = require ( './index' ) ;
3
+ const Trie = require ( '../index' ) ;
4
4
5
5
describe ( 'Data Structure : Trie' , ( ) => {
6
6
it ( 'Should be class of type Trie' , ( ) => {
@@ -11,24 +11,24 @@ describe('Data Structure : Trie', () => {
11
11
describe ( 'Trie' , ( ) => {
12
12
13
13
it ( 'Should return 6.' , ( ) => {
14
- let newTrie = new Trie ( ) ;
14
+ const newTrie = new Trie ( ) ;
15
15
const words = [ 'bed' , 'ball' , 'apple' , 'java' , 'javascript' , 'bed' ] ;
16
16
words . forEach ( word => newTrie . insert ( word ) ) ;
17
- result = totalWordsInTrie ( newTrie . root ) ;
17
+ const result = totalWordsInTrie ( newTrie . root ) ;
18
18
assert . equal ( result , 6 ) ;
19
19
} ) ;
20
20
21
21
it ( 'Should return 0.' , ( ) => {
22
- let newTrie = new Trie ( ) ;
23
- result = totalWordsInTrie ( newTrie . root ) ;
22
+ const newTrie = new Trie ( ) ;
23
+ const result = totalWordsInTrie ( newTrie . root ) ;
24
24
assert . equal ( result , 0 ) ;
25
25
} ) ;
26
26
27
27
it ( 'Should return 6.' , ( ) => {
28
- let newTrie = new Trie ( ) ;
28
+ const newTrie = new Trie ( ) ;
29
29
const words = [ 'bed' , 'ball' , '' , 'apple' , 'java' , 'javascript' , 'bed' ] ;
30
30
words . forEach ( word => newTrie . insert ( word ) ) ;
31
- result = totalWordsInTrie ( newTrie . root ) ;
31
+ const result = totalWordsInTrie ( newTrie . root ) ;
32
32
assert . equal ( result , 6 ) ;
33
33
} ) ;
34
34
} ) ;
0 commit comments