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 { ResourceStore } from '../../../../src/storage/ResourceStore';
|
||||
import { RegexRouterRule } from '../../../../src/storage/routing/RegexRouterRule';
|
||||
import { UnsupportedHttpError } from '../../../../src/util/errors/UnsupportedHttpError';
|
||||
import { BadRequestHttpError } from '../../../../src/util/errors/BadRequestHttpError';
|
||||
|
||||
describe('A RegexRouterRule', (): void => {
|
||||
const base = 'http://test.com/';
|
||||
@@ -9,13 +9,13 @@ describe('A RegexRouterRule', (): void => {
|
||||
it('rejects identifiers not containing the base.', async(): Promise<void> => {
|
||||
const router = new RegexRouterRule(base, {});
|
||||
await expect(router.canHandle({ identifier: { path: 'http://notTest.com/apple' }}))
|
||||
.rejects.toThrow(new UnsupportedHttpError(`Identifiers need to start with http://test.com`));
|
||||
.rejects.toThrow(new BadRequestHttpError(`Identifiers need to start with http://test.com`));
|
||||
});
|
||||
|
||||
it('rejects identifiers not matching any regex.', async(): Promise<void> => {
|
||||
const router = new RegexRouterRule(base, { pear: store });
|
||||
await expect(router.canHandle({ identifier: { path: `${base}apple/` }}))
|
||||
.rejects.toThrow(new UnsupportedHttpError(`No stored regexes match http://test.com/apple/`));
|
||||
.rejects.toThrow(new BadRequestHttpError(`No stored regexes match http://test.com/apple/`));
|
||||
});
|
||||
|
||||
it('accepts identifiers matching any regex.', async(): Promise<void> => {
|
||||
|
||||
Reference in New Issue
Block a user