Skip to content

Commit fe0290f

Browse files
authored
Function in "sort with a function" test should be a comparator
The function used in "should sort with a function" is not a comparator. Not that a function passed to `Array.sort` should follow some rule that the previous function was violating. It is just a coincidence that the test was passing.
1 parent 2db2ea2 commit fe0290f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ describe('arraySort', function() {
120120
var arr = [{key: 'y'}, {key: 'z'}, {key: 'x'}];
121121

122122
var actual = arraySort(arr, function(a, b) {
123-
return a.key > b.key;
123+
return a.key < b.key ? -1 : (a.key > b.key ? 1 : 0);
124124
});
125125

126126
actual.should.eql([

0 commit comments

Comments
 (0)