Skip to content

Commit 55a04d3

Browse files
committed
fix: add error try and catch
1 parent 7f6a7b6 commit 55a04d3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Maths/test/Determinant.test.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { expect } from 'vitest'
12
import { determinant } from '../Determinant'
23
describe('Determinant', () => {
34
const testCases = [
@@ -50,7 +51,11 @@ describe('Determinant', () => {
5051
test.each(testCases)(
5152
'Should return the determinant of the square matrix.',
5253
(matrix, expected) => {
53-
expect(determinant(matrix)).toEqual(expected)
54+
try {
55+
expect(determinant(matrix)).toEqual(expected)
56+
} catch (err) {
57+
expect(err.message).toEqual(expected)
58+
}
5459
}
5560
)
5661
})

0 commit comments

Comments
 (0)