From fe0290f2f5c7c5f17ca1a9645430a4c438cc67b8 Mon Sep 17 00:00:00 2001 From: Jan Stola Date: Mon, 2 Jan 2017 14:51:20 +0100 Subject: [PATCH] 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. --- test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test.js b/test.js index f1e43f2..43c116f 100644 --- a/test.js +++ b/test.js @@ -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([