mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
feat: Let Authorizers output an Authorization
This commit is contained in:
@@ -1,13 +1,23 @@
|
||||
import { AllowEverythingAuthorizer } from '../../../src/authorization/AllowEverythingAuthorizer';
|
||||
import type { PermissionSet } from '../../../src/ldp/permissions/PermissionSet';
|
||||
|
||||
describe('An AllowEverythingAuthorizer', (): void => {
|
||||
const authorizer = new AllowEverythingAuthorizer();
|
||||
const allowEverything: PermissionSet = {
|
||||
read: true,
|
||||
write: true,
|
||||
append: true,
|
||||
control: true,
|
||||
};
|
||||
|
||||
it('can handle everything.', async(): Promise<void> => {
|
||||
await expect(authorizer.canHandle({} as any)).resolves.toBeUndefined();
|
||||
});
|
||||
|
||||
it('always returns undefined.', async(): Promise<void> => {
|
||||
await expect(authorizer.handle()).resolves.toBeUndefined();
|
||||
it('always returns an empty Authorization.', async(): Promise<void> => {
|
||||
await expect(authorizer.handle()).resolves.toEqual({
|
||||
user: allowEverything,
|
||||
everyone: allowEverything,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user