mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
feat: add simple target extractor
This commit is contained in:
17
test/unit/ldp/http/SimpleTargetExtractor.test.ts
Normal file
17
test/unit/ldp/http/SimpleTargetExtractor.test.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { SimpleTargetExtractor } from '../../../../src/ldp/http/SimpleTargetExtractor';
|
||||
|
||||
describe('A SimpleTargetExtractor', (): void => {
|
||||
const extractor = new SimpleTargetExtractor();
|
||||
|
||||
it('can handle input with an URL.', async(): Promise<void> => {
|
||||
await expect(extractor.canHandle({ url: 'url' } as any)).resolves.toBeUndefined();
|
||||
});
|
||||
|
||||
it('rejects input without URL.', async(): Promise<void> => {
|
||||
await expect(extractor.canHandle({ } as any)).rejects.toThrow('Missing URL.');
|
||||
});
|
||||
|
||||
it('returns the input URL.', async(): Promise<void> => {
|
||||
await expect(extractor.handle({ url: 'url' } as any)).resolves.toEqual({ path: 'url' });
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user