mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
16 lines
585 B
TypeScript
16 lines
585 B
TypeScript
import { BadRequestHttpError } from '../../../../src/util/errors/BadRequestHttpError';
|
|
import { StaticThrowHandler } from '../../../../src/util/handlers/StaticThrowHandler';
|
|
|
|
describe('A StaticThrowHandler', (): void => {
|
|
const error = new BadRequestHttpError();
|
|
const handler = new StaticThrowHandler(error);
|
|
|
|
it('can handle all requests.', async(): Promise<void> => {
|
|
await expect(handler.canHandle({})).resolves.toBeUndefined();
|
|
});
|
|
|
|
it('always throws the given error.', async(): Promise<void> => {
|
|
await expect(handler.handle()).rejects.toThrow(error);
|
|
});
|
|
});
|