-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
db5dddc
commit c0e1999
Showing
20 changed files
with
730 additions
and
727 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,31 @@ | ||
import test from 'node:test'; | ||
import assert from 'node:assert'; | ||
import getStatusByError from './error-status.js'; | ||
import test from 'node:test' | ||
import assert from 'node:assert' | ||
import getStatusByError from './error-status.js' | ||
|
||
const TestCases = [ | ||
{ | ||
description: 'A normal error should return status 500', | ||
error: new Error('test'), | ||
expectedResult: 500, | ||
expectedResult: 500 | ||
}, | ||
{ | ||
description: 'A type error should return status 422', | ||
error: new TypeError('test'), | ||
expectedResult: 422, | ||
expectedResult: 422 | ||
}, | ||
{ | ||
description: 'A range error should return status 404', | ||
error: new RangeError('test'), | ||
expectedResult: 404, | ||
}, | ||
]; | ||
expectedResult: 404 | ||
} | ||
] | ||
|
||
test('Error status entity', async (t) => { | ||
await Promise.all( | ||
TestCases.map(async ({ description, error, expectedResult }) => { | ||
await t.test(description, () => { | ||
assert.deepEqual(getStatusByError(error), expectedResult); | ||
}); | ||
assert.deepEqual(getStatusByError(error), expectedResult) | ||
}) | ||
}) | ||
); | ||
}); | ||
) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.