Commit c3d266f3 authored by Paul Kaplan's avatar Paul Kaplan

Add in pending tests for missing project removal functionality

parent 0f8baaaa
...@@ -107,6 +107,7 @@ describe('studio projects', () => { ...@@ -107,6 +107,7 @@ describe('studio projects', () => {
expect(selectCanAddProjects(state)).toBe(expected); expect(selectCanAddProjects(state)).toBe(expected);
}); });
}); });
describe('can remove projects', () => { describe('can remove projects', () => {
test.each([ test.each([
['admin', true], ['admin', true],
...@@ -118,9 +119,11 @@ describe('studio projects', () => { ...@@ -118,9 +119,11 @@ describe('studio projects', () => {
['logged out', false] ['logged out', false]
])('%s: %s', (role, expected) => { ])('%s: %s', (role, expected) => {
setStateByRole(role); setStateByRole(role);
// TODO this permission is wrong, curators can only remove projects they added
expect(selectCanRemoveProjects(state)).toBe(expected); expect(selectCanRemoveProjects(state)).toBe(expected);
}); });
// TODO this permission is wrong, curators can only remove projects they added
test.skip('anyone can remove one of their projects', () => {});
test.skip('curators can remove only projects they', () => {});
}); });
}); });
...@@ -232,92 +235,98 @@ describe('studio comments', () => { ...@@ -232,92 +235,98 @@ describe('studio comments', () => {
expect(selectCanEditOpenToAll(state)).toBe(expected); expect(selectCanEditOpenToAll(state)).toBe(expected);
}); });
}); });
describe('studio members', () => { });
describe('can accept invitation', () => {
test.each([ describe('studio members', () => {
['admin', false], describe('can accept invitation', () => {
['curator', false], test.each([
['manager', false], ['admin', false],
['creator', false], ['curator', false],
['invited', true], ['manager', false],
['logged in', false], ['creator', false],
['unconfirmed', false], ['invited', true],
['logged out', false] ['logged in', false],
])('%s: %s', (role, expected) => { ['unconfirmed', false],
setStateByRole(role); ['logged out', false]
expect(selectShowCuratorInvite(state)).toBe(expected); ])('%s: %s', (role, expected) => {
}); setStateByRole(role);
expect(selectShowCuratorInvite(state)).toBe(expected);
}); });
describe('can promote curators', () => { });
test.each([
['admin', false], describe('can promote curators', () => {
['curator', false], test.each([
['manager', true], ['admin', false],
['creator', true], ['curator', false],
['logged in', false], ['manager', true],
['unconfirmed', false], ['creator', true],
['logged out', false] ['logged in', false],
])('%s: %s', (role, expected) => { ['unconfirmed', false],
setStateByRole(role); ['logged out', false]
expect(selectCanPromoteCurators(state)).toBe(expected); ])('%s: %s', (role, expected) => {
}); setStateByRole(role);
expect(selectCanPromoteCurators(state)).toBe(expected);
}); });
describe('can remove curators', () => { });
test.each([
['admin', true], describe('can remove curators', () => {
['curator', false], test.each([
['manager', true], ['admin', true],
['creator', true], ['curator', false],
['logged in', false], ['manager', true],
['unconfirmed', false], ['creator', true],
['logged out', false] ['logged in', false],
])('%s: %s', (role, expected) => { ['unconfirmed', false],
setStateByRole(role); ['logged out', false]
expect(selectCanRemoveCurators(state)).toBe(expected); ])('%s: %s', (role, expected) => {
}); setStateByRole(role);
expect(selectCanRemoveCurators(state)).toBe(expected);
}); });
describe('can remove managers', () => { });
test.each([
['admin', true], describe('can remove managers', () => {
['curator', false], test.each([
['manager', true], ['admin', true],
['creator', true], ['curator', false],
['logged in', false], ['manager', true],
['unconfirmed', false], ['creator', true],
['logged out', false] ['logged in', false],
])('%s: %s', (role, expected) => { ['unconfirmed', false],
setStateByRole(role); ['logged out', false]
expect(selectCanRemoveManager(state, '123')).toBe(expected); ])('%s: %s', (role, expected) => {
}); setStateByRole(role);
describe('nobody can remove the studio creator', () => { expect(selectCanRemoveManager(state, '123')).toBe(expected);
test.each([
['admin', false],
['curator', false],
['manager', false],
['creator', false],
['logged in', false],
['unconfirmed', false],
['logged out', false]
])('%s: %s', (role, expected) => {
setStateByRole(role);
state.studio.owner = 'the creator';
expect(selectCanRemoveManager(state, 'the creator')).toBe(expected);
});
});
}); });
describe('can invite curators', () => {
describe('nobody can remove the studio creator', () => {
test.each([ test.each([
['admin', false], ['admin', false],
['curator', false], ['curator', false],
['manager', true], ['manager', false],
['creator', false], ['creator', false],
['logged in', false], ['logged in', false],
['unconfirmed', false], ['unconfirmed', false],
['logged out', false] ['logged out', false]
])('%s: %s', (role, expected) => { ])('%s: %s', (role, expected) => {
setStateByRole(role); setStateByRole(role);
expect(selectCanInviteCurators(state)).toBe(expected); state.studio.owner = 'the creator';
expect(selectCanRemoveManager(state, 'the creator')).toBe(expected);
}); });
}); });
}); });
describe('can invite curators', () => {
test.each([
['admin', false],
['curator', false],
['manager', true],
['creator', false],
['logged in', false],
['unconfirmed', false],
['logged out', false]
])('%s: %s', (role, expected) => {
setStateByRole(role);
expect(selectCanInviteCurators(state)).toBe(expected);
});
});
}); });
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