Skip to content

add TDD realization to tree data structure #10

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Saveli0S
Copy link

Check please my TDD workshop.

@Saveli0S Saveli0S closed this Jun 12, 2019
@Saveli0S Saveli0S reopened this Jun 12, 2019
it('Should set key, value to root if root is null', function() {
const tree = new Tree();
tree.insert('elem1', 1);
expect(tree.root.key).to.be.equal('elem1');
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better to use number key and not string

tree.insert(1, 'elem6')
expect(tree.root.right.left.key).to.be.equal(1);
expect(tree.root.right.left.key).to.be.equal('elem6');
});
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 redundant tests. better to separate them onto 3 with more descriptive names and scenarios.

tree.delete(5);
expect(tree.search('elem4')).to.be.throw(ReferenceError, 'This tree doesn\'t contain search value');
});
});
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

over all not bad scenarios.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants