Skip to content

Commit

Permalink
#1157 Added correct PUT tests to check the query parameters.
Browse files Browse the repository at this point in the history
  • Loading branch information
david-rocca committed Jan 5, 2024
1 parent 9713736 commit e94f131
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions test/integration-tests/user/updateUserTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,41 @@ describe('Testing Edit user endpoint', () => {
expect(res.body.error).to.contain('NOT_ORG_ADMIN_OR_SECRETARIAT_UPDATE')
})
})
it('Should not allow a first name of more than 100 characters', async () => {
await chai.request(app)
.put('/api/org/win_5/user/jasminesmith@win_5.com?name.first=1:1234567,2:1234567,3:1234567,4:1234567,5:1234567,6:1234567,7:1234567,8:1234567,9:1234567,10:1234567,11:1234567')
.set(constants.nonSecretariatUserHeaders)
.then((res, err) => {
expect(res).to.have.status(400)
expect(res.body.error).to.contain('BAD_INPUT')
})
})
it('Should not allow a middle name of more than 100 characters', async () => {
await chai.request(app)
.put('/api/org/win_5/user/jasminesmith@win_5.com?name.middle=1:1234567,2:1234567,3:1234567,4:1234567,5:1234567,6:1234567,7:1234567,8:1234567,9:1234567,10:1234567,11:1234567')
.set(constants.nonSecretariatUserHeaders)
.then((res, err) => {
expect(res).to.have.status(400)
expect(res.body.error).to.contain('BAD_INPUT')
})
})
it('Should not allow a last name of more than 100 characters', async () => {
await chai.request(app)
.put('/api/org/win_5/user/jasminesmith@win_5.com?name.last=1:1234567,2:1234567,3:1234567,4:1234567,5:1234567,6:1234567,7:1234567,8:1234567,9:1234567,10:1234567,11:1234567')
.set(constants.nonSecretariatUserHeaders)
.then((res, err) => {
expect(res).to.have.status(400)
expect(res.body.error).to.contain('BAD_INPUT')
})
})
it('Should not allow a suffix of more than 100 characters', async () => {
await chai.request(app)
.put('/api/org/win_5/user/jasminesmith@win_5.com?name.suffix=1:1234567,2:1234567,3:1234567,4:1234567,5:1234567,6:1234567,7:1234567,8:1234567,9:1234567,10:1234567,11:1234567')
.set(constants.nonSecretariatUserHeaders)
.then((res, err) => {
expect(res).to.have.status(400)
expect(res.body.error).to.contain('BAD_INPUT')
})
})
})
})

0 comments on commit e94f131

Please sign in to comment.