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:
17
test/unit/authorization/SimpleAuthorizer.test.ts
Normal file
17
test/unit/authorization/SimpleAuthorizer.test.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { AuthorizerArgs } from '../../../src/authorization/Authorizer';
|
||||
import { SimpleAuthorizer } from '../../../src/authorization/SimpleAuthorizer';
|
||||
import { UnsupportedHttpError } from '../../../src/util/errors/UnsupportedHttpError';
|
||||
|
||||
describe('A SimpleAuthorizer', (): void => {
|
||||
const authorizer = new SimpleAuthorizer();
|
||||
|
||||
it('requires input to have an identifier and permissions.', async(): Promise<void> => {
|
||||
await expect(authorizer.canHandle({ identifier: {}, permissions: {}} as AuthorizerArgs)).resolves.toBeUndefined();
|
||||
await expect(authorizer.canHandle({ identifier: {}} as AuthorizerArgs)).rejects.toThrow(UnsupportedHttpError);
|
||||
await expect(authorizer.canHandle({ permissions: {}} as AuthorizerArgs)).rejects.toThrow(UnsupportedHttpError);
|
||||
});
|
||||
|
||||
it('always returns undefined.', async(): Promise<void> => {
|
||||
await expect(authorizer.handle()).resolves.toBeUndefined();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user