mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-12-02 11:59:07 -05:00
add unit test for permissions
This commit is contained in:
parent
123b186e75
commit
dbf9b18d5b
1 changed files with 25 additions and 0 deletions
|
@ -15,6 +15,7 @@ import {
|
||||||
selectCanRemoveManager,
|
selectCanRemoveManager,
|
||||||
selectCanPromoteCurators,
|
selectCanPromoteCurators,
|
||||||
selectCanRemoveProject,
|
selectCanRemoveProject,
|
||||||
|
selectCanTransfer,
|
||||||
selectShowCommentsList,
|
selectShowCommentsList,
|
||||||
selectShowCommentsGloballyOffError,
|
selectShowCommentsGloballyOffError,
|
||||||
selectShowProjectMuteError,
|
selectShowProjectMuteError,
|
||||||
|
@ -432,6 +433,30 @@ describe('studio members', () => {
|
||||||
expect(selectCanInviteCurators(state)).toBe(expected);
|
expect(selectCanInviteCurators(state)).toBe(expected);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('can transfer host', () => {
|
||||||
|
test.each([
|
||||||
|
['admin', true],
|
||||||
|
['curator', false],
|
||||||
|
['manager', false],
|
||||||
|
['creator', true],
|
||||||
|
['logged in', false],
|
||||||
|
['unconfirmed', false],
|
||||||
|
['logged out', false],
|
||||||
|
['muted creator', true], // Muted users do not see the transfer UI
|
||||||
|
['muted logged in', false]
|
||||||
|
])('%s: %s', (role, expected) => {
|
||||||
|
setStateByRole(role);
|
||||||
|
state.studio = {...state.studio, managers: 2, classroomId: null};
|
||||||
|
// Only admin and host see the option to transfer the current host
|
||||||
|
expect(selectCanTransfer(state, state.studio.owner)).toBe(expected);
|
||||||
|
// Nobody sees the option to transfer a manager who is not the host
|
||||||
|
expect(selectCanTransfer(state, 123)).toBe(false);
|
||||||
|
// Nobody can transfer classroom studios
|
||||||
|
state.studio = {...state.studio, classroomId: 1};
|
||||||
|
expect(selectCanTransfer(state, state.studio.owner)).toBe(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('studio mute errors', () => {
|
describe('studio mute errors', () => {
|
||||||
|
|
Loading…
Reference in a new issue