Handle social auth in A/B testing (#8024)

* fix(AB-testing): handle social auth

* refactor(AB-testing): move to pre save hooks
This commit is contained in:
Sabe Jones
2016-09-16 12:13:21 -05:00
committed by Matteo Pagliazzi
parent 81b7eeeb71
commit 86c9bddc09
3 changed files with 20 additions and 10 deletions

View File

@@ -2,6 +2,7 @@ import {
generateUser,
requester,
translate as t,
getProperty,
} from '../../../../../helpers/api-integration/v3';
import passport from 'passport';
@@ -44,6 +45,15 @@ describe('POST /user/auth/social', () => {
expect(response.newUser).to.be.true;
});
it('enrolls a new user in an A/B test', async () => {
await api.post(endpoint, {
authResponse: {access_token: randomAccessToken}, // eslint-disable-line camelcase
network,
});
await expect(getProperty('users', user._id, '_ABtest')).to.eventually.be.a('string');
});
it('logs an existing user in', async () => {
await user.update({ 'auth.facebook.id': facebookId });