mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
feat: file-based backend fallback for unknown media types
This commit is contained in:
committed by
Joachim Van Herwegen
parent
fa78bc6856
commit
ff80079000
@@ -125,11 +125,16 @@ describe('An ExtensionBasedMapper', (): void => {
|
||||
});
|
||||
});
|
||||
|
||||
it('throws 501 if the given content-type is not recognized.', async(): Promise<void> => {
|
||||
const result = mapper.mapUrlToFilePath({ path: `${base}test.txt` }, false, 'fake/data');
|
||||
await expect(result).rejects.toThrow(NotImplementedHttpError);
|
||||
await expect(result).rejects.toThrow('Unsupported content type fake/data');
|
||||
});
|
||||
it('falls back to custom extension for unknown types (for which no custom mapping exists).',
|
||||
async(): Promise<void> => {
|
||||
const result = mapper.mapUrlToFilePath({ path: `${base}test` }, false, 'unknown/content-type');
|
||||
await expect(result).resolves.toEqual({
|
||||
identifier: { path: `${base}test` },
|
||||
filePath: `${rootFilepath}test$.unknown`,
|
||||
contentType: undefined,
|
||||
isMetadata: false,
|
||||
});
|
||||
});
|
||||
|
||||
it('supports custom types.', async(): Promise<void> => {
|
||||
const customMapper = new ExtensionBasedMapper(base, rootFilepath, { cstm: 'text/custom' });
|
||||
|
||||
Reference in New Issue
Block a user