From ececabf12cda40e95b3e200e4ab4b5105bee25fe Mon Sep 17 00:00:00 2001 From: Mayguen Ojeda <37992848+Mindgames55@users.noreply.github.com> Date: Wed, 14 Jun 2023 16:07:15 -0400 Subject: [PATCH] Pass comparison callback to sort radix-sort.test.js **unit tests bug** unit tests rely on `Array.sort` . However, there is no comparison function which will sort the array as they were strings. Not sure why tests passed in the case of the solution file. Sandbox is not very good for debugging but test should also fail in there bc of the bug in the test not the algo --- 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..e7cf3c99 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)); }); });