Merge branch 'develop' into client-monorepo

This commit is contained in:
Matteo Pagliazzi
2019-10-18 20:26:12 +02:00
17 changed files with 292 additions and 45 deletions
+23
View File
@@ -386,6 +386,7 @@ describe('User Model', () => {
user = await user.save();
// verify that it's been awarded
expect(user.achievements.beastMaster).to.equal(true);
expect(user.notifications.find(notification => notification.type === 'ACHIEVEMENT_BEAST_MASTER')).to.exist;
// reset the user
user.achievements.beastMasterCount = 0;
@@ -417,6 +418,28 @@ describe('User Model', () => {
expect(user.achievements.beastMaster).to.not.equal(true);
});
it('adds achievements to notification list', async () => {
let user = new User();
user = await user.save(); // necessary for user.isSelected to work correctly
// Create conditions for achievements to be awarded
user.achievements.beastMasterCount = 3;
user.achievements.mountMasterCount = 3;
user.achievements.triadBingoCount = 3;
// verify that it was not awarded initially
expect(user.achievements.beastMaster).to.not.equal(true);
// verify that it was not awarded initially
expect(user.achievements.mountMaster).to.not.equal(true);
// verify that it was not awarded initially
expect(user.achievements.triadBingo).to.not.equal(true);
user = await user.save();
// verify that it's been awarded
expect(user.notifications.find(notification => notification.type === 'ACHIEVEMENT_BEAST_MASTER')).to.exist;
expect(user.notifications.find(notification => notification.type === 'ACHIEVEMENT_MOUNT_MASTER')).to.exist;
expect(user.notifications.find(notification => notification.type === 'ACHIEVEMENT_TRIAD_BINGO')).to.exist;
});
context('manage unallocated stats points notifications', () => {
it('doesn\'t add a notification if there are no points to allocate', async () => {
let user = new User();