Skip to content

Commit cc07003

Browse files
committed
fix: refactor the test cases with adding interface for the module
1 parent f53cf76 commit cc07003

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Diff for: Sorts/test/QuickSortRecursive.test.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,29 @@ import { quickSort } from '../QuickSortRecursive'
22

33
describe('QuickSortRecursive | Partition In Place Method', () => {
44
it('Expectedly, throw some error if we pass a non-array input', () => {
5-
expect(() => quickSort('xyz', 0, 2)).toThrow(
5+
expect(() => quickSort('xyz')).toThrow(
66
'Please input a valid list or array.'
77
)
8-
expect(() => quickSort(null, 0, 4)).toThrow(
8+
expect(() => quickSort(null)).toThrow(
99
'Please input a valid list or array.'
1010
)
11-
expect(() => quickSort(55, 0, 2)).toThrow(
11+
expect(() => quickSort(55)).toThrow(
1212
'Please input a valid list or array.'
1313
)
1414
})
1515

1616
it('Expectedly, the quickSort method will sort the unsorted list in ascending order', () => {
1717
const unSortArray = [5, 9, 3, 4, 6, 2, 0, 1, 7, 8]
1818
const sortedExpectedArray = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
19-
expect(quickSort(unSortArray, 0, unSortArray.length - 1)).toEqual(
19+
expect(quickSort(unSortArray)).toEqual(
2020
sortedExpectedArray
2121
)
2222
})
2323

2424
it('Expectedly, the quickSort method will arrange the list of character values in dictionary order.', () => {
2525
const unSortList = ['d', 'e', 'c', 'a', 'f', 'b']
2626
const sortedExpectedList = ['a', 'b', 'c', 'd', 'e', 'f']
27-
expect(quickSort(unSortList, 0, unSortList.length - 1)).toEqual(
27+
expect(quickSort(unSortList)).toEqual(
2828
sortedExpectedList
2929
)
3030
})

0 commit comments

Comments
 (0)