mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
feat: Let CredentialsExtractors specify what type of Credentials they generate
This commit is contained in:
@@ -1,15 +1,16 @@
|
||||
import { CredentialGroup } from '../../../src/authentication/Credentials';
|
||||
import { UnsecureConstantCredentialsExtractor } from '../../../src/authentication/UnsecureConstantCredentialsExtractor';
|
||||
|
||||
describe('An UnsecureConstantCredentialsExtractor', (): void => {
|
||||
it('extracts a constant WebID.', async(): Promise<void> => {
|
||||
const agent = 'http://alice.example/card#me';
|
||||
const extractor = new UnsecureConstantCredentialsExtractor(agent);
|
||||
await expect(extractor.handle()).resolves.toEqual({ webId: agent });
|
||||
await expect(extractor.handle()).resolves.toEqual({ [CredentialGroup.agent]: { webId: agent }});
|
||||
});
|
||||
|
||||
it('extracts constant credentials.', async(): Promise<void> => {
|
||||
const agent = {};
|
||||
const extractor = new UnsecureConstantCredentialsExtractor(agent);
|
||||
await expect(extractor.handle()).resolves.toBe(agent);
|
||||
await expect(extractor.handle()).resolves.toEqual({ [CredentialGroup.agent]: agent });
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user