habitica/test/api/v2/user/GET-user.test.js

32 lines
777 B
JavaScript
Raw Normal View History

2015-10-17 23:27:19 +00:00
import {
generateUser,
2015-11-03 14:31:20 +00:00
} from '../../../helpers/api-integration.helper';
2015-10-17 23:27:19 +00:00
describe('GET /user', () => {
2015-10-25 13:14:16 +00:00
let user;
2015-10-17 23:27:19 +00:00
2015-10-29 02:06:28 +00:00
before(() => {
2015-10-25 13:14:16 +00:00
return generateUser().then((usr) => {
return usr.get('/user');
2015-10-29 02:06:28 +00:00
}).then((fetchedUser) => {
user = fetchedUser;
2015-10-25 13:14:16 +00:00
});
2015-10-17 23:27:19 +00:00
});
it('gets the user object', () => {
2015-10-29 02:06:28 +00:00
expect(user._id).to.eql(user._id);
expect(user.auth.local.username).to.eql(user.auth.local.username);
expect(user.todos).to.eql(user.todos);
expect(user.items).to.eql(user.items);
});
it('does not include password information', () => {
expect(user.auth.local.hashed_password).to.not.exist
expect(user.auth.local.salt).to.not.exist
});
it('does not include api token', () => {
expect(user.apiToken).to.not.exist
2015-10-17 23:27:19 +00:00
});
});