We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 00d997c commit 686c8a9Copy full SHA for 686c8a9
test/searching/binarysearch.spec.js
@@ -9,8 +9,9 @@ describe('Binary search', function () {
9
expect(binarySearch([1, 2, 3, 4, 6, 8], 1)).toBe(0);
10
});
11
12
- it('should find the eleent in position arr.length', function () {
13
- expect(binarySearch([1, 2, 3, 4, 6, 8], 1)).toBe(0);
+ it('should find the element in position arr.length - 1', function () {
+ var arr = [1, 2, 3, 4, 6, 8];
14
+ expect(binarySearch(arr, 8)).toBe(arr.length - 1);
15
16
17
it('should work with arrays with 2 elements', function () {
@@ -31,6 +32,7 @@ describe('Binary search', function () {
31
32
33
34
it('should work with a key function', function () {
- expect(binarySearch([{ x: 1 }, { x: 2 }, { x: 3 }], { x: 2 }, function (o) { return o.x; })).toBe(1);
35
+ expect(binarySearch([{ x: 1 }, { x: 2 }, { x: 3 }],
36
+ { x: 2 }, function (o) { return o.x; })).toBe(1);
37
38
0 commit comments