-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PP-7843 Stop selecting default option on permission level radios
- Loading branch information
Showing
6 changed files
with
31 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,4 +23,27 @@ describe('invite user controller', () => { | |
sinon.assert.calledWith(req.flash, 'genericError', 'Enter a valid email address') | ||
sinon.assert.calledWith(res.redirect, 303, `/service/${externalServiceId}/team-members/invite`) | ||
}) | ||
|
||
it('should error if a role is not recognised', async () => { | ||
const externalServiceId = 'some-external-service-id' | ||
const unknownRoleId = '999' | ||
const req = { | ||
user: { externalId: 'some-ext-id', serviceIds: ['1'] }, | ||
body: { | ||
'invitee-email': '[email protected]', | ||
'role-input': unknownRoleId | ||
}, | ||
service: { | ||
externalId: externalServiceId | ||
}, | ||
flash: sinon.stub() | ||
} | ||
const res = { | ||
redirect: sinon.stub() | ||
} | ||
|
||
await inviteUserController.invite(req, res) | ||
sinon.assert.calledWith(req.flash, 'genericError', 'Select the team member\'s permission level') | ||
sinon.assert.calledWith(res.redirect, 303, `/service/${externalServiceId}/team-members/invite`) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,27 +85,5 @@ describe('invite user controller', function () { | |
}) | ||
.end(done) | ||
}) | ||
|
||
it('should error on unknown role externalId', function (done) { | ||
const unknownRoleId = '999' | ||
|
||
const app = session.getAppWithLoggedInUser(getApp(), userInSession) | ||
|
||
supertest(app) | ||
.post(formatServicePathsFor(paths.service.teamMembers.invite, EXTERNAL_SERVICE_ID)) | ||
.set('Accept', 'application/json') | ||
.set('Content-Type', 'application/x-www-form-urlencoded') | ||
.set('x-request-id', 'bob') | ||
.send({ | ||
'invitee-email': '[email protected]', | ||
'role-input': unknownRoleId, | ||
csrfToken: csrf().create('123') | ||
}) | ||
.expect(500) | ||
.expect((res) => { | ||
expect(res.body.message).to.equal('There is a problem with the payments platform. Please contact the support team.') | ||
}) | ||
.end(done) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters