Fixed broken tests and style changes

This commit is contained in:
Keith Holliday
2016-11-29 08:53:36 -06:00
parent 1d2482f8bc
commit 8582a67308
2 changed files with 7 additions and 9 deletions
+6 -8
View File
@@ -704,14 +704,14 @@ describe('cron', () => {
cron({user, tasksByType, daysMissed, analytics});
expect(user.notifications.length - notifsBefore2).to.equal(1);
expect(user.notifications[1].type).to.not.equal('CRON');
expect(user.notifications[2].type).to.equal('CRON');
expect(user.notifications[2].data).to.eql({
expect(user.notifications.length - notifsBefore2).to.equal(0);
expect(user.notifications[0].type).to.not.equal('CRON');
expect(user.notifications[1].type).to.equal('CRON');
expect(user.notifications[1].data).to.eql({
hp: user.stats.hp - hpBefore2 - (hpBefore2 - hpBefore1),
mp: user.stats.mp - mpBefore2 - (mpBefore2 - mpBefore1),
});
expect(user.notifications[1].type).to.not.equal('CRON');
expect(user.notifications[0].type).to.not.equal('CRON');
});
});
@@ -785,9 +785,7 @@ describe('cron', () => {
cron({user, tasksByType, daysMissed, analytics});
cron({user, tasksByType, daysMissed, analytics});
let filteredNotifications = filter(user.notifications, function filterNotifications (notification) {
return notification.type === 'LOGIN_INCENTIVE';
});
let filteredNotifications = user.notifications.filter(n => n.type === 'LOGIN_INCENTIVE');
expect(filteredNotifications.length).to.equal(1);
});
+1 -1
View File
@@ -131,7 +131,7 @@ function trackCronAnalytics (analytics, user, _progress, options) {
function awardLoginIncentives (user) {
if (user.loginIncentives > 50) return;
// Remove old noitification if it exists
// Remove old notifications if they exists
user.notifications
.toObject()
.find((notif, index) => {