shared nodes actions permission (#224)

This commit is contained in:
Cilibiu Bogdan
2018-03-06 18:17:06 +02:00
committed by Denys Vuika
parent a401b3d90a
commit a9d98fbe83
3 changed files with 71 additions and 3 deletions

View File

@@ -298,4 +298,52 @@ describe('PageComponent', () => {
expect(component.nodeHasPermission(node, 'some-operation')).toBe(false);
});
});
describe('canDeleteShared()', () => {
it('should return true if shared node can be deleted', () => {
const selection = [ { entry: {
allowableOperationsOnTarget: ['delete']
} } ];
expect(component.canDeleteShared(selection)).toBe(true);
});
it(`should return false if shared node doesn't have permission`, () => {
const selection = [ { entry: {
allowableOperationsOnTarget: ['something']
} } ];
expect(component.canDeleteShared(selection)).toBe(false);
});
it(`should return false if shared node doesn't have permissions property`, () => {
const selection = [ { entry: { } } ];
expect(component.canDeleteShared(selection)).toBe(false);
});
});
describe('canMoveShared()', () => {
it('should return true if shared node can be moved', () => {
const selection = [ { entry: {
allowableOperationsOnTarget: ['delete']
} } ];
expect(component.canMoveShared(selection)).toBe(true);
});
it(`should return false if shared node doesn't have permission`, () => {
const selection = [ { entry: {
allowableOperationsOnTarget: ['something']
} } ];
expect(component.canMoveShared(selection)).toBe(false);
});
it(`should return false if shared node doesn't have permissions property`, () => {
const selection = [ { entry: { } } ];
expect(component.canMoveShared(selection)).toBe(false);
});
});
});