-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* added a test case for instructor-course-edit-page * addressed lint errors --------- Co-authored-by: Justin <[email protected]> Co-authored-by: Dominic Lim <[email protected]>
- Loading branch information
1 parent
e17c33a
commit 38341d6
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -194,6 +194,34 @@ describe('InstructorCourseEditPageComponent', () => { | |
expect(component.courseFormModel.course.courseName).toBe('Example Course Changed'); | ||
}); | ||
|
||
it('should update instructor details if SAVE is requested', () => { | ||
jest.spyOn(instructorService, 'loadInstructors').mockReturnValue(of({ | ||
instructors: [testInstructor1], | ||
})); | ||
|
||
component.loadCourseInstructors(); | ||
|
||
component.isInstructorsLoading = false; | ||
fixture.detectChanges(); | ||
|
||
component.instructorDetailPanels[0].editPanel.isEditing = true; | ||
component.instructorDetailPanels[0].editPanel.name = 'Example Instructor Changed'; | ||
fixture.detectChanges(); | ||
|
||
jest.spyOn(instructorService, 'updateInstructor').mockReturnValue(of({ | ||
courseId: 'exampleId', | ||
email: '[email protected]', | ||
joinState: JoinState.JOINED, | ||
name: 'Example Instructor Changed', | ||
})); | ||
|
||
const button: any = fixture.debugElement.nativeElement.querySelector('#btn-save-instructor-1'); | ||
button.click(); | ||
|
||
expect(component.instructorDetailPanels[0].editPanel.isEditing).toBeFalsy(); | ||
expect(component.instructorDetailPanels[0].editPanel.name).toBe('Example Instructor Changed'); | ||
}); | ||
|
||
it('should load correct instructors details for given API output', () => { | ||
jest.spyOn(instructorService, 'loadInstructors').mockReturnValue(of({ | ||
instructors: [testInstructor1, testInstructor2], | ||
|