fix: allows leader of challenge to create new challenge tasks even when not a participant of the challenge. fixes #7918

closes #7924
This commit is contained in:
Husman
2016-08-24 08:22:58 -07:00
committed by Blade Barringer
parent 5bcc2561ae
commit 2308e14d3e
2 changed files with 8 additions and 9 deletions

View File

@@ -33,20 +33,19 @@ describe('POST /tasks/challenge/:challengeId', () => {
});
});
it('returns error when user does not have the challenge', async () => {
let userWithoutChallenge = await generateUser();
await expect(userWithoutChallenge.post(`/tasks/challenge/${challenge._id}`, {
it('allows leader to add tasks to a challenge when not a member', async () => {
await user.post(`/challenges/${challenge._id}/leave`);
let task = await user.post(`/tasks/challenge/${challenge._id}`, {
text: 'test habit',
type: 'habit',
up: false,
down: true,
notes: 1976,
})).to.eventually.be.rejected.and.eql({
code: 404,
error: 'NotFound',
message: t('challengeNotFound'),
});
let {tasksOrder} = await user.get(`/challenges/${challenge._id}`);
expect(tasksOrder.habits).to.include(task.id);
});
it('returns error when user tries to create task with a alias', async () => {