mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
Move api tests to v2 namespace
This commit is contained in:
33
test/api/v2/user/GET-user.test.js
Normal file
33
test/api/v2/user/GET-user.test.js
Normal file
@@ -0,0 +1,33 @@
|
||||
import {
|
||||
generateUser,
|
||||
requester,
|
||||
} from '../../../helpers/api-integration.helper';
|
||||
|
||||
describe('GET /user', () => {
|
||||
let user;
|
||||
|
||||
before(() => {
|
||||
return generateUser().then((usr) => {
|
||||
let api = requester(usr);
|
||||
return api.get('/user');
|
||||
}).then((fetchedUser) => {
|
||||
user = fetchedUser;
|
||||
});
|
||||
});
|
||||
|
||||
it('gets the user object', () => {
|
||||
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
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user