-
Notifications
You must be signed in to change notification settings - Fork 268
Increase code coverage #142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make the changes, there are a lot but if you do it file by file that will be easy
@@ -0,0 +1,40 @@ | |||
const DLL = require('.'); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check for DLL should be a Class
expect(queue.dequeue()).toEqual(null); | ||
}); | ||
|
||
it('Length of linkedlist', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'Length of linkedlist' should be 'Size of Queue'
expect(queue2.length()).toEqual(4); | ||
}); | ||
|
||
it('Destroy linkedList', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'Destroy linkedList' should be 'Destroy Queue'
describe('Doubly Linked List', () => { | ||
const doublyLinkedList = new DLL(); | ||
|
||
it('create DLL', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'create DLL' -> 'It should create a DLL'
It's all about Behavior Driven Testing, hence it starts with or contains should
expect(doublyLinkedList.length()).toEqual(0); | ||
}); | ||
|
||
it('addAtBeginning', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change title
@@ -3,18 +3,15 @@ | |||
* | |||
* Given values of two values n1 and n2 in a Binary Search Tree, find the Lowest Common Ancestor (LCA). You may assume that both the values exist in the tree. | |||
*/ | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Write a meaningful function name
function lca(node, n1, n2) { | ||
if (node == null) | ||
return null; | ||
if (node == null) return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use ===
@@ -5,8 +5,7 @@ const BinarySearchTree = require('../index'); | |||
// {"left":{"left":{"data":4},"right":{"left":{"data":10},"right":{"data":14},"data":12},"data":8},"right":{"data":22},"data":20} | |||
|
|||
describe('LCA', () => { | |||
|
|||
let bst = new BinarySearchTree(20); | |||
const bst = new BinarySearchTree(20); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct all the titles
bst.add(4); | ||
bst.add(9); | ||
bst.add(2); | ||
bst.add(5); | ||
bst.add(8); | ||
bst.add(12); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use loop here
bst.remove(6); | ||
bst.remove(4); | ||
bst.remove(9); | ||
bst.remove(2); | ||
bst.remove(5); | ||
bst.remove(8); | ||
bst.remove(12); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use loop here
Thanks @ashokdey . Please review the changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great Job 🎉
🍰 What's Inside?
- TernarySearch
- JumpSearch
- get-smallest-common-number
- anagrams
- AStar
- lowest-common-ancestor
- height-of-bst
- postfix-expression-evaluation
- Queue
- LinkedList
🎉 New Coverage will be 97% after merging.