mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-14 13:17:24 +01:00
feat(analytics): AB testing
User model update for AB tests, and the first AB test to start Sept 12 closes #7984
This commit is contained in:
committed by
Blade Barringer
parent
6f2767edd3
commit
f20a7b851f
@@ -3,6 +3,7 @@ import {
|
||||
requester,
|
||||
translate as t,
|
||||
createAndPopulateGroup,
|
||||
getProperty,
|
||||
} from '../../../../../helpers/api-integration/v3';
|
||||
import { v4 as generateRandomUserName } from 'uuid';
|
||||
import { each } from 'lodash';
|
||||
@@ -52,6 +53,21 @@ describe('POST /user/auth/local/register', () => {
|
||||
expect(user.tasksOrder.habits).to.have.a.lengthOf(0);
|
||||
});
|
||||
|
||||
it('enrolls new users in an A/B test', 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,
|
||||
});
|
||||
|
||||
await expect(getProperty('users', user._id, '_ABtest')).to.eventually.be.a('string');
|
||||
});
|
||||
|
||||
it('requires password and confirmPassword to match', async () => {
|
||||
let username = generateRandomUserName();
|
||||
let email = `${username}@example.com`;
|
||||
|
||||
Reference in New Issue
Block a user