-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#10920] Add front-end tests for instructor courses page #10967
[#10920] Add front-end tests for instructor courses page #10967
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great Work!
Let's add some more tests
- Snapshot tests for the boolean variables which affect the layout of the page
- Unit tests to ensure that service methods are called properly with proper params
Added more tests here:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -292,10 +292,10 @@ export class InstructorCoursesPageComponent implements OnInit { | |||
/** | |||
* Permanently deletes a soft-deleted course in Recycle Bin. | |||
*/ | |||
onDeletePermanently(courseId: string): void { | |||
onDeletePermanently(courseId: string): Promise<void> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the goal of returning Promise here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The promise helps us to know if the function has finished deleting the course (because the ngbmodal result itself is a promise) -- otherwise, it would be hard for the tests to know when the async operations are done before testing for the desired changes. There doesn't seem to be any other way to do it that's as straightforward as using promises, so I went with this approach
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Part of #10920
Outline of Solution