Skip to content

Commit

Permalink
Merge branch 'release' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
SabreCat committed Nov 3, 2020
2 parents 6375bc1 + 3f65353 commit 8bad3d1
Show file tree
Hide file tree
Showing 78 changed files with 10,510 additions and 10,424 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "habitica",
"description": "A habit tracker app which treats your goals like a Role Playing Game.",
"version": "4.167.2",
"version": "4.168.0",
"main": "./website/server/index.js",
"dependencies": {
"@babel/core": "^7.12.3",
Expand Down
25 changes: 4 additions & 21 deletions test/api/unit/middlewares/cronMiddleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,25 +311,8 @@ describe('cron middleware', () => {
});
});

it('does not enroll 50% of users', async () => {
sandbox.stub(Math, 'random').returns(0.6);
user.lastCron = moment(new Date()).subtract({ days: 2 });
await user.save();
req.headers['x-client'] = 'habitica-web';

await new Promise((resolve, reject) => {
cronMiddleware(req, res, async err => {
if (err) return reject(err);
user = await User.findById(user._id).exec();
expect(user._ABtests.dropCapNotif).to.be.equal('drop-cap-notif-not-enrolled');

return resolve();
});
});
});

it('enables the new notification for 25% of users', async () => {
sandbox.stub(Math, 'random').returns(0.25);
it('enables the new notification for 50% of users', async () => {
sandbox.stub(Math, 'random').returns(0.5);
user.lastCron = moment(new Date()).subtract({ days: 2 });
await user.save();
req.headers['x-client'] = 'habitica-web';
Expand All @@ -345,8 +328,8 @@ describe('cron middleware', () => {
});
});

it('disables the new notification for 25% of users', async () => {
sandbox.stub(Math, 'random').returns(0.5);
it('disables the new notification for 50% of users', async () => {
sandbox.stub(Math, 'random').returns(0.51);
user.lastCron = moment(new Date()).subtract({ days: 2 });
await user.save();
req.headers['x-client'] = 'habitica-web';
Expand Down
Loading

0 comments on commit 8bad3d1

Please sign in to comment.