mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-08-04 09:39:23 +00:00
add support for habitica-android in x-client header
This commit is contained in:
parent
3385cb807e
commit
c5b7873406
2 changed files with 52 additions and 1 deletions
|
|
@ -240,4 +240,55 @@ describe('POST /register', () => {
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
context('successful login with habitica-android header', () => {
|
||||
let api, username, email, password;
|
||||
|
||||
beforeEach(() => {
|
||||
api = requester({}, {'x-client': 'habitica-android'});
|
||||
username = generateRandomUserName();
|
||||
email = `${username}@example.com`;
|
||||
password = 'password';
|
||||
});
|
||||
|
||||
it('sets all common tutorial flags to true', () => {
|
||||
return api.post('/register', {
|
||||
username: username,
|
||||
email: email,
|
||||
password: password,
|
||||
confirmPassword: password,
|
||||
}).then((user) => {
|
||||
expect(user.flags.tour).to.not.be.empty;
|
||||
|
||||
each(user.flags.tutorial.common, (value, attribute) => {
|
||||
expect(value).to.eql(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('populates user with default todos, habits, and rewards', () => {
|
||||
return api.post('/register', {
|
||||
username: username,
|
||||
email: email,
|
||||
password: password,
|
||||
confirmPassword: password,
|
||||
}).then((user) => {
|
||||
expect(user.todos).to.not.be.empty;
|
||||
expect(user.dailys).to.be.empty;
|
||||
expect(user.habits).to.not.be.empty;
|
||||
expect(user.rewards).to.not.be.empty;
|
||||
});
|
||||
});
|
||||
|
||||
it('populates user with default tags', () => {
|
||||
return api.post('/register', {
|
||||
username: username,
|
||||
email: email,
|
||||
password: password,
|
||||
confirmPassword: password,
|
||||
}).then((user) => {
|
||||
expect(user.tags).to.not.be.empty;
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -585,7 +585,7 @@ UserSchema.methods.unlink = function(options, cb) {
|
|||
function _populateDefaultsForNewUser(user) {
|
||||
var taskTypes;
|
||||
|
||||
if (user.registeredThrough === "habitica-web") {
|
||||
if (user.registeredThrough === "habitica-web" || user.registeredThrough === "habitica-android") {
|
||||
taskTypes = ['habits', 'dailys', 'todos', 'rewards', 'tags'];
|
||||
|
||||
var tutorialCommonSections = [
|
||||
|
|
|
|||
Loading…
Reference in a new issue