mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
feat: add custom errors
This commit is contained in:
17
test/unit/util/errors/UnsupportedHttpError.test.ts
Normal file
17
test/unit/util/errors/UnsupportedHttpError.test.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { UnsupportedHttpError } from '../../../../src/util/errors/UnsupportedHttpError';
|
||||
|
||||
describe('An UnsupportedHttpError', (): void => {
|
||||
it('has status code 400.', async (): Promise<void> => {
|
||||
const error = new UnsupportedHttpError('test');
|
||||
|
||||
expect(error.statusCode).toEqual(400);
|
||||
expect(error.message).toEqual('test');
|
||||
expect(error.name).toEqual('UnsupportedHttpError');
|
||||
});
|
||||
|
||||
it('has a default message if none was provided.', async (): Promise<void> => {
|
||||
const error = new UnsupportedHttpError();
|
||||
|
||||
expect(error.message).toEqual('The given input is not supported by the server configuration.');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user