mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
fix: Rename UnsupportedHttpError into BadRequestError.
This commit is contained in:
committed by
Joachim Van Herwegen
parent
03ffaaed43
commit
af8f1976cd
@@ -1,6 +1,6 @@
|
||||
import type { AsyncHandler } from '../../../src/util/AsyncHandler';
|
||||
import { BadRequestHttpError } from '../../../src/util/errors/BadRequestHttpError';
|
||||
import { HttpError } from '../../../src/util/errors/HttpError';
|
||||
import { UnsupportedHttpError } from '../../../src/util/errors/UnsupportedHttpError';
|
||||
import { FirstCompositeHandler } from '../../../src/util/FirstCompositeHandler';
|
||||
import { StaticAsyncHandler } from '../../util/StaticAsyncHandler';
|
||||
|
||||
@@ -111,7 +111,7 @@ describe('A FirstCompositeHandler', (): void => {
|
||||
});
|
||||
});
|
||||
|
||||
it('throws an UnsupportedHttpError if handlers throw different errors.', async(): Promise<void> => {
|
||||
it('throws an BadRequestHttpError if handlers throw different errors.', async(): Promise<void> => {
|
||||
handlerTrue.canHandle = async(): Promise<void> => {
|
||||
throw new HttpError(401, 'UnauthorizedHttpError');
|
||||
};
|
||||
@@ -120,7 +120,7 @@ describe('A FirstCompositeHandler', (): void => {
|
||||
};
|
||||
const handler = new FirstCompositeHandler([ handlerTrue, handlerFalse ]);
|
||||
|
||||
await expect(handler.canHandle(null)).rejects.toThrow(UnsupportedHttpError);
|
||||
await expect(handler.canHandle(null)).rejects.toThrow(BadRequestHttpError);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import { UnsupportedHttpError } from '../../../../src/util/errors/UnsupportedHttpError';
|
||||
import { BadRequestHttpError } from '../../../../src/util/errors/BadRequestHttpError';
|
||||
|
||||
describe('An UnsupportedHttpError', (): void => {
|
||||
describe('An BadRequestHttpError', (): void => {
|
||||
it('has status code 400.', async(): Promise<void> => {
|
||||
const error = new UnsupportedHttpError('test');
|
||||
const error = new BadRequestHttpError('test');
|
||||
|
||||
expect(error.statusCode).toEqual(400);
|
||||
expect(error.message).toEqual('test');
|
||||
expect(error.name).toEqual('UnsupportedHttpError');
|
||||
expect(error.name).toEqual('BadRequestHttpError');
|
||||
});
|
||||
|
||||
it('has a default message if none was provided.', async(): Promise<void> => {
|
||||
const error = new UnsupportedHttpError();
|
||||
const error = new BadRequestHttpError();
|
||||
|
||||
expect(error.message).toEqual('The given input is not supported by the server configuration.');
|
||||
});
|
||||
Reference in New Issue
Block a user