Skip to content

Commit

Permalink
test when capabilities are not specified
Browse files Browse the repository at this point in the history
  • Loading branch information
andaley committed Oct 25, 2019
1 parent ed058b8 commit 518288c
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions ui/tests/unit/services/permissions-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ module('Unit | Service | permissions', function(hooks) {
assert.deepEqual(service.navPathParams('access'), expected);
});

test('hasNavPermission returns true if a policy includes access to at least one path', function(assert) {
test('hasNavPermission returns true if a policy includes the required capabilities for at least one path', function(assert) {
let service = this.owner.lookup('service:permissions');
const accessPaths = {
'sys/auth': {
Expand All @@ -168,7 +168,20 @@ module('Unit | Service | permissions', function(hooks) {
},
};
service.set('exactPaths', accessPaths);
assert.equal(service.hasNavPermission('access', 'groups', ['list', 'read']), true);
assert.equal(
service.hasNavPermission(
'access',
'groups',
['list', 'read'],
'checks permission when multiple capabilities are specified'
),
true
);
assert.equal(
service.hasNavPermission('access', 'groups'),
true,
'checks permission when capabilities are not specified'
);
});

test('hasNavPermission returns false if a policy does not include access to any paths', function(assert) {
Expand Down

0 comments on commit 518288c

Please sign in to comment.