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
@@ -7,8 +7,8 @@ import {
|
||||
matchingTypes,
|
||||
validateRequestArgs,
|
||||
} from '../../../../src/storage/conversion/ConversionUtil';
|
||||
import { BadRequestHttpError } from '../../../../src/util/errors/BadRequestHttpError';
|
||||
import { InternalServerError } from '../../../../src/util/errors/InternalServerError';
|
||||
import { UnsupportedHttpError } from '../../../../src/util/errors/UnsupportedHttpError';
|
||||
|
||||
describe('ConversionUtil', (): void => {
|
||||
const identifier: ResourceIdentifier = { path: 'path' };
|
||||
@@ -66,7 +66,7 @@ describe('ConversionUtil', (): void => {
|
||||
const preferences: RepresentationPreferences =
|
||||
{ type: [{ value: 'b/x', weight: 1 }, { value: 'b/x', weight: 0 }]};
|
||||
expect((): any => matchingTypes(preferences, [ 'b/x' ]))
|
||||
.toThrow(new UnsupportedHttpError(`Duplicate type preference found: b/x`));
|
||||
.toThrow(new BadRequestHttpError(`Duplicate type preference found: b/x`));
|
||||
});
|
||||
|
||||
it('errors if there invalid types.', async(): Promise<void> => {
|
||||
|
||||
@@ -9,7 +9,7 @@ import type { RepresentationPreferences } from '../../../../src/ldp/representati
|
||||
import type { ResourceIdentifier } from '../../../../src/ldp/representation/ResourceIdentifier';
|
||||
import { RdfToQuadConverter } from '../../../../src/storage/conversion/RdfToQuadConverter';
|
||||
import { INTERNAL_QUADS } from '../../../../src/util/ContentTypes';
|
||||
import { UnsupportedHttpError } from '../../../../src/util/errors/UnsupportedHttpError';
|
||||
import { BadRequestHttpError } from '../../../../src/util/errors/BadRequestHttpError';
|
||||
import { CONTENT_TYPE } from '../../../../src/util/UriConstants';
|
||||
|
||||
describe('A RdfToQuadConverter.test.ts', (): void => {
|
||||
@@ -80,7 +80,7 @@ describe('A RdfToQuadConverter.test.ts', (): void => {
|
||||
) ]);
|
||||
});
|
||||
|
||||
it('throws an UnsupportedHttpError on invalid triple data.', async(): Promise<void> => {
|
||||
it('throws an BadRequestHttpError on invalid triple data.', async(): Promise<void> => {
|
||||
const metadata = new RepresentationMetadata({ [CONTENT_TYPE]: 'text/turtle' });
|
||||
const representation = {
|
||||
data: streamifyArray([ '<http://test.com/s> <http://test.com/p> <http://test.co' ]),
|
||||
@@ -94,6 +94,6 @@ describe('A RdfToQuadConverter.test.ts', (): void => {
|
||||
metadata: expect.any(RepresentationMetadata),
|
||||
});
|
||||
expect(result.metadata.contentType).toEqual(INTERNAL_QUADS);
|
||||
await expect(arrayifyStream(result.data)).rejects.toThrow(UnsupportedHttpError);
|
||||
await expect(arrayifyStream(result.data)).rejects.toThrow(BadRequestHttpError);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user