mirror of
https://github.com/trekhleb/javascript-algorithms.git
synced 2026-03-13 08:51:02 +08:00
Avoid using toBeTruthy() and toBeFalsy() because of type coercion.
This commit is contained in:
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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', () => {
|
||||
|
||||
Reference in New Issue
Block a user