tests(api): Convert tests to use new api user methods

This commit is contained in:
Blade Barringer
2015-12-29 17:34:33 -06:00
parent b2336c7adf
commit 4cf9518a5a
28 changed files with 213 additions and 313 deletions

View File

@@ -1,24 +1,22 @@
import {
generateUser,
requester,
translate as t,
} from '../../../helpers/api-integration.helper';
import { each } from 'lodash';
describe('PUT /user', () => {
let api, user;
let user;
beforeEach(() => {
return generateUser().then((usr) => {
user = usr;
api = requester(user);
});
});
context('allowed operations', () => {
it('updates the user', () => {
return api.put('/user', {
return user.put('/user', {
'profile.name' : 'Frodo',
'preferences.costume': true,
'stats.hp': 14,
@@ -47,7 +45,7 @@ describe('PUT /user', () => {
each(data, (value, operation) => {
errorText.push(t('messageUserOperationProtected', { operation: operation }));
});
return expect(api.put('/user', data)).to.eventually.be.rejected.and.eql({
return expect(user.put('/user', data)).to.eventually.be.rejected.and.eql({
code: 401,
text: errorText,
});
@@ -66,7 +64,7 @@ describe('PUT /user', () => {
each(data, (value, operation) => {
errorText.push(t('messageUserOperationProtected', { operation: operation }));
});
return expect(api.put('/user', data)).to.eventually.be.rejected.and.eql({
return expect(user.put('/user', data)).to.eventually.be.rejected.and.eql({
code: 401,
text: errorText,
});