Commit a77c6560 by Daniel Lee

dashfolders: adds test for permission store

parent cc55ab6b
......@@ -57,30 +57,30 @@ describe('PermissionsStore', () => {
expect(backendSrv.post.mock.calls[0][0]).toBe('/api/dashboards/id/1/acl');
});
// describe('when duplicate team permissions are added', () => {
// beforeEach(() => {
// const newItem = {
// teamId: 10,
// team: 'tester-team',
// permission: 1,
// dashboardId: 1,
// };
// store.resetNewType();
// store.newItem.setTeam(newItem.teamId, newItem.team);
// store.newItem.setPermission(newItem.permission);
// store.addStoreItem();
// store.newItem.setTeam(newItem.teamId, newItem.team);
// store.newItem.setPermission(newItem.permission);
// store.addStoreItem();
// });
// it('should return a validation error', () => {
// expect(store.items.length).toBe(4);
// expect(store.error).toBe('This permission exists already.');
// expect(backendSrv.post.mock.calls.length).toBe(1);
// });
// });
describe('when duplicate team permissions are added', () => {
beforeEach(() => {
const newItem = {
teamId: 10,
team: 'tester-team',
permission: 1,
dashboardId: 1,
};
store.resetNewType();
store.newItem.setTeam(newItem.teamId, newItem.team);
store.newItem.setPermission(newItem.permission);
store.addStoreItem();
store.newItem.setTeam(newItem.teamId, newItem.team);
store.newItem.setPermission(newItem.permission);
store.addStoreItem();
});
it('should return a validation error', () => {
expect(store.items.length).toBe(4);
expect(store.error).toBe('This permission exists already.');
expect(backendSrv.post.mock.calls.length).toBe(1);
});
});
describe('when duplicate user permissions are added', () => {
beforeEach(() => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment