Skip to content
This repository was archived by the owner on Apr 16, 2024. It is now read-only.

Commit 77b6219

Browse files
authored
Merge pull request #418 from h-da/bugfix/DeleteCourseTest
Fixed Test.
2 parents bfd8189 + 49a3ead commit 77b6219

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

api/test/integration/course.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,12 @@ describe('Course', () => {
234234

235235
it('should fail because the teacher is not in the course', async () => {
236236
const course = await Course.findOne({name: 'Computer Graphics'});
237-
const user = await User.findOne({role: 'teacher'});
237+
const allTeachersAndAdmins = course.teachers;
238+
allTeachersAndAdmins.push(course.courseAdmin);
239+
const user = await User.findOne( {$and: [
240+
{role: 'teacher'},
241+
{_id: {$nin: allTeachersAndAdmins}}
242+
]});
238243
return new Promise((resolve, reject) => {
239244
chai.request(app)
240245
.del(`${BASE_URL}/${course._id}`)

0 commit comments

Comments
 (0)