Permalink
Browse files

Fix/add group and role permission checking test

  • Loading branch information...
1 parent 87f39be commit 3e9b731d560684f08708ebd4450ad308e3d2d5d4 @mcchrish mcchrish committed Nov 25, 2016
Showing with 12 additions and 0 deletions.
  1. +12 −0 test/hooks/check-permissions.test.js
@@ -110,6 +110,18 @@ describe('hooks:checkPermissions', () => {
it('sets hook.params.permitted', () => {
hook.params.user.permissions = ['admin'];
options.group = 'admin';
+ delete options.service;
+ return checkPermissions(options)(hook).then(hook => {
+ expect(hook.params.permitted).to.equal(true);
+ });
+ });
+ });
+ describe('when entity has matched role permission', () => {
+ it('sets hook.params.permitted', () => {
+ hook.params.user.role = 'admin';
+ options.field = 'role';
+ options.roles = ['admin'];
+ delete options.service;
return checkPermissions(options)(hook).then(hook => {
expect(hook.params.permitted).to.equal(true);
});

0 comments on commit 3e9b731

Please sign in to comment.