From 60d4897fdbe09a970199c2b49b1ff7b04d25952f Mon Sep 17 00:00:00 2001 From: Patricio Date: Sat, 24 Jul 2021 12:48:26 -0400 Subject: [PATCH] Missing compare function in test According to MDN docs [on Array.prototype.sort](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort) >The default sort order is ascending, built upon converting the elements into strings ```javascript [100,2].sort() // [100, 2]``` So we would need the compare function to sort numbers properly ```javascript [100,2].sort((a,b) => a - b) // [2, 100]``` --- specs/radix-sort/radix-sort.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/radix-sort/radix-sort.test.js b/specs/radix-sort/radix-sort.test.js index b32ae006..6bafa7a1 100644 --- a/specs/radix-sort/radix-sort.test.js +++ b/specs/radix-sort/radix-sort.test.js @@ -71,6 +71,6 @@ describe.skip("radix sort", function () { .fill() .map(() => Math.floor(Math.random() * 500000)); const ans = radixSort(nums); - expect(ans).toEqual(nums.sort()); + expect(ans).toEqual(nums.sort((a,b) => a - b)); }); });