Avoid using toBeTruthy() and toBeFalsy() because of type coercion.

This commit is contained in:
Oleksii Trekhleb
2018-07-26 16:14:26 +03:00
parent 8da83cd9dc
commit 39acb2b65d
25 changed files with 367 additions and 367 deletions

View File

@@ -44,8 +44,8 @@ describe('Trie', () => {
trie.addWord('car');
trie.addWord('caption');
expect(trie.doesWordExist('cat')).toBeTruthy();
expect(trie.doesWordExist('cap')).toBeTruthy();
expect(trie.doesWordExist('call')).toBeFalsy();
expect(trie.doesWordExist('cat')).toBe(true);
expect(trie.doesWordExist('cap')).toBe(true);
expect(trie.doesWordExist('call')).toBe(false);
});
});

View File

@@ -5,7 +5,7 @@ describe('TrieNode', () => {
const trieNode = new TrieNode('c', true);
expect(trieNode.character).toBe('c');
expect(trieNode.isCompleteWord).toBeTruthy();
expect(trieNode.isCompleteWord).toBe(true);
expect(trieNode.toString()).toBe('c*');
});
@@ -35,9 +35,9 @@ describe('TrieNode', () => {
trieNode.addChild('a');
trieNode.addChild('o');
expect(trieNode.hasChild('a')).toBeTruthy();
expect(trieNode.hasChild('o')).toBeTruthy();
expect(trieNode.hasChild('b')).toBeFalsy();
expect(trieNode.hasChild('a')).toBe(true);
expect(trieNode.hasChild('o')).toBe(true);
expect(trieNode.hasChild('b')).toBe(false);
});
it('should suggest next children', () => {