Skip to content

Commit

Permalink
Wrong url when doing assign users with a callback (#686)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamjmcgrath authored Jan 26, 2022
1 parent 3b59185 commit 532a4bf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/management/RolesManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ class RolesManager {
}

if (cb && cb instanceof Function) {
return this.permissions.create(params, data, cb);
return this.users.create(params, data, cb);
}

return this.users.create(params, data);
Expand Down
10 changes: 10 additions & 0 deletions test/management/roles.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,16 @@ describe('RolesManager', () => {
});
});

it('should perform a POST request to /api/v2/roles/rol_ID/users with a callback', function (done) {
const { request } = this;

this.roles.assignUsers(this.data, {}, () => {
expect(request.isDone()).to.be.true;

done();
});
});

it('should pass the data in the body of the request', function (done) {
nock.cleanAll();

Expand Down

0 comments on commit 532a4bf

Please sign in to comment.