drop cap ab test: misc fixes (#12694)

This commit is contained in:
Matteo Pagliazzi
2020-10-19 16:53:28 +02:00
committed by GitHub
parent ec0e5024a7
commit 69281f80ea
6 changed files with 45 additions and 29 deletions

View File

@@ -592,6 +592,20 @@ describe('User Model', () => {
});
context('pre-save hook', () => {
it('enrolls users that signup through web in the Drop Cap AB test', async () => {
let user = new User();
user.registeredThrough = 'habitica-web';
user = await user.save();
expect(user._ABtests.dropCapNotif).to.exist;
});
it('does not enroll users that signup through modal in the Drop Cap AB test', async () => {
let user = new User();
user.registeredThrough = 'habitica-ios';
user = await user.save();
expect(user._ABtests.dropCapNotif).to.not.exist;
});
it('marks the last news post as read for new users', async () => {
const lastNewsPost = { _id: '1' };
sandbox.stub(NewsPost, 'lastNewsPost').returns(lastNewsPost);