mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
feat: add simple permissions related handlers
This commit is contained in:
19
test/unit/authentication/SimpleCredentialsExtractor.test.ts
Normal file
19
test/unit/authentication/SimpleCredentialsExtractor.test.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { HttpRequest } from '../../../src/server/HttpRequest';
|
||||
import { SimpleCredentialsExtractor } from '../../../src/authentication/SimpleCredentialsExtractor';
|
||||
|
||||
describe('A SimpleCredentialsExtractor', (): void => {
|
||||
const extractor = new SimpleCredentialsExtractor();
|
||||
|
||||
it('can handle all input.', async(): Promise<void> => {
|
||||
await expect(extractor.canHandle()).resolves.toBeUndefined();
|
||||
});
|
||||
|
||||
it('returns undefined if there is no input.', async(): Promise<void> => {
|
||||
await expect(extractor.handle({ headers: {}} as HttpRequest)).resolves.toBeUndefined();
|
||||
});
|
||||
|
||||
it('returns the authorization header as webID if there is one.', async(): Promise<void> => {
|
||||
await expect(extractor.handle({ headers: { authorization: 'test' }} as HttpRequest))
|
||||
.resolves.toEqual({ webID: 'test' });
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user