added test case for #8423 (#8434)

This commit is contained in:
Jaka Kranjc
2017-01-24 11:15:08 +01:00
committed by Matteo Pagliazzi
parent 8c8af83dfc
commit 04f4eb8490

View File

@@ -2,6 +2,7 @@ import {
generateUser, generateUser,
translate as t, translate as t,
createAndPopulateGroup, createAndPopulateGroup,
generateGroup,
generateChallenge, generateChallenge,
sleep, sleep,
} from '../../../../helpers/api-integration/v3'; } from '../../../../helpers/api-integration/v3';
@@ -186,6 +187,40 @@ describe('POST /user/class/cast/:spellId', () => {
expect(group.chat[0].uuid).to.equal('system'); expect(group.chat[0].uuid).to.equal('system');
}); });
it('searing brightness does not affect challenge or group tasks', async () => {
let guild = await generateGroup(user);
let challenge = await generateChallenge(user, guild);
await user.post(`/tasks/challenge/${challenge._id}`, {
text: 'test challenge habit',
type: 'habit',
});
let groupTask = await user.post(`/tasks/group/${guild._id}`, {
text: 'todo group',
type: 'todo',
});
await user.update({'stats.class': 'healer', 'stats.mp': 200, 'stats.lvl': 15});
await user.post(`/tasks/${groupTask._id}/assign/${user._id}`);
await user.post('/user/class/cast/brightness');
await user.sync();
let memberTasks = await user.get('/tasks/user');
let syncedGroupTask = find(memberTasks, function findAssignedTask (memberTask) {
return memberTask.group.id === guild._id;
});
let userChallengeTask = find(memberTasks, function findAssignedTask (memberTask) {
return memberTask.challenge.id === challenge._id;
});
expect(userChallengeTask).to.exist;
expect(syncedGroupTask).to.exist;
expect(userChallengeTask.value).to.equal(0);
expect(syncedGroupTask.value).to.equal(0);
});
// TODO find a way to have sinon working in integration tests // TODO find a way to have sinon working in integration tests
// it doesn't work when tests are running separately from server // it doesn't work when tests are running separately from server
it('passes correct target to spell when targetType === \'task\''); it('passes correct target to spell when targetType === \'task\'');