Skip to content

Commit

Permalink
Function in "sort with a function" test should be a comparator
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
iamstolis authored Jan 2, 2017
1 parent 2db2ea2 commit fe0290f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion test.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ describe('arraySort', function() {
var arr = [{key: 'y'}, {key: 'z'}, {key: 'x'}];

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

actual.should.eql([
Expand Down

0 comments on commit fe0290f

Please sign in to comment.