mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-14 05:07:22 +01:00
chore: Provide additional tests for local login defaults
This commit is contained in:
@@ -33,6 +33,25 @@ describe('POST /user/auth/local/register', () => {
|
|||||||
expect(user.auth.local.username).to.eql(username);
|
expect(user.auth.local.username).to.eql(username);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('provides default tags and tasks', async () => {
|
||||||
|
let username = generateRandomUserName();
|
||||||
|
let email = `${username}@example.com`;
|
||||||
|
let password = 'password';
|
||||||
|
|
||||||
|
let user = await api.post('/user/auth/local/register', {
|
||||||
|
username,
|
||||||
|
email,
|
||||||
|
password,
|
||||||
|
confirmPassword: password,
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(user.tags).to.have.a.lengthOf(7);
|
||||||
|
expect(user.tasksOrder.todos).to.have.a.lengthOf(1);
|
||||||
|
expect(user.tasksOrder.dailys).to.have.a.lengthOf(0);
|
||||||
|
expect(user.tasksOrder.rewards).to.have.a.lengthOf(0);
|
||||||
|
expect(user.tasksOrder.habits).to.have.a.lengthOf(0);
|
||||||
|
});
|
||||||
|
|
||||||
it('requires password and confirmPassword to match', async () => {
|
it('requires password and confirmPassword to match', async () => {
|
||||||
let username = generateRandomUserName();
|
let username = generateRandomUserName();
|
||||||
let email = `${username}@example.com`;
|
let email = `${username}@example.com`;
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ describe('POST /user/auth/social', () => {
|
|||||||
user = await generateUser();
|
user = await generateUser();
|
||||||
|
|
||||||
let expectedResult = {id: facebookId};
|
let expectedResult = {id: facebookId};
|
||||||
let passportFacebookProfile = sinon.stub(passport._strategies.facebook, 'userProfile');
|
let passportFacebookProfile = sandbox.stub(passport._strategies.facebook, 'userProfile');
|
||||||
passportFacebookProfile.yields(null, expectedResult);
|
passportFacebookProfile.yields(null, expectedResult);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user