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

29 lines
740 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
before(async async () => {
let usr = await generateUser();
user = await usr.get('/user');
2015-10-17 23:27:19 +00:00
});
it('gets the user object', async () => {
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', async () => {
2015-10-29 02:06:28 +00:00
expect(user.auth.local.hashed_password).to.not.exist
expect(user.auth.local.salt).to.not.exist
});
it('does not include api token', async () => {
2015-10-29 02:06:28 +00:00
expect(user.apiToken).to.not.exist
2015-10-17 23:27:19 +00:00
});
});