mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-15 21:57:22 +01:00
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:
@@ -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 () => {
|
||||
|
||||
Reference in New Issue
Block a user