diff --git a/test/api/v2/user/PUT-user.test.js b/test/api/v2/user/PUT-user.test.js index dfe955af22..17a6e27400 100644 --- a/test/api/v2/user/PUT-user.test.js +++ b/test/api/v2/user/PUT-user.test.js @@ -14,15 +14,15 @@ describe('PUT /user', () => { context('allowed operations', () => { it('updates the user', async () => { - return user.put('/user', { + let updatedUser = await user.put('/user', { 'profile.name' : 'Frodo', 'preferences.costume': true, 'stats.hp': 14, - }).then((updatedUser) => { - expect(updatedUser.profile.name).to.eql('Frodo'); - expect(updatedUser.preferences.costume).to.eql(true); - expect(updatedUser.stats.hp).to.eql(14); }); + + expect(updatedUser.profile.name).to.eql('Frodo'); + expect(updatedUser.preferences.costume).to.eql(true); + expect(updatedUser.stats.hp).to.eql(14); }); }); @@ -43,7 +43,8 @@ describe('PUT /user', () => { each(data, (value, operation) => { errorText.push(t('messageUserOperationProtected', { operation: operation })); }); - return expect(user.put('/user', data)).to.eventually.be.rejected.and.eql({ + + await expect(user.put('/user', data)).to.eventually.be.rejected.and.eql({ code: 401, text: errorText, }); @@ -62,7 +63,8 @@ describe('PUT /user', () => { each(data, (value, operation) => { errorText.push(t('messageUserOperationProtected', { operation: operation })); }); - return expect(user.put('/user', data)).to.eventually.be.rejected.and.eql({ + + await expect(user.put('/user', data)).to.eventually.be.rejected.and.eql({ code: 401, text: errorText, });