Closed jcoder58 closed 9 years ago
You mean the test description is incorrect? The code looks fine to me.
The code is testing the wrong thing. Here's the first two tests:
it('should find the element at position 0 ', function () {
expect(binarySearch([1, 2, 3, 4, 6, 8], 1)).toBe(0);
});
it('should find the eleent in position arr.length', function () {
expect(binarySearch([1, 2, 3, 4, 6, 8], 1)).toBe(0);
});
The call to binarySeach has identical parameters for both tests, even though the comments say different things. So the second test either needs to be eliminated, as it tests the same as the first, or it needs to be changed to match the comment.
@jcoder58 thanks for the issue! I didn't notice that previously :smile:
This test from searching/ binarysearch.spec.js has two issues: