mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Updated gh-user-can-admin unit test
no issue - helper now calls `.get('isOwnerOrAdmin')` rather than `.get('admin')` or `.get('owner')`
This commit is contained in:
parent
313ff0b669
commit
d6d98ba5ca
1 changed files with 2 additions and 21 deletions
|
@ -4,29 +4,10 @@ import {ghUserCanAdmin} from 'ghost-admin/helpers/gh-user-can-admin';
|
||||||
|
|
||||||
describe('Unit: Helper: gh-user-can-admin', function () {
|
describe('Unit: Helper: gh-user-can-admin', function () {
|
||||||
// Mock up roles and test for truthy
|
// Mock up roles and test for truthy
|
||||||
describe('Owner role', function () {
|
describe('Owner or admin roles', function () {
|
||||||
let user = {
|
let user = {
|
||||||
get(role) {
|
get(role) {
|
||||||
if (role === 'isOwner') {
|
if (role === 'isOwnerOrAdmin') {
|
||||||
return true;
|
|
||||||
} else if (role === 'isAdmin') {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
it(' - can be Admin', function () {
|
|
||||||
let result = ghUserCanAdmin([user]);
|
|
||||||
expect(result).to.equal(true);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('Administrator role', function () {
|
|
||||||
let user = {
|
|
||||||
get(role) {
|
|
||||||
if (role === 'isOwner') {
|
|
||||||
return false;
|
|
||||||
} else if (role === 'isAdmin') {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue