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
[#9480] Add snapshot test for student list component #9582
[#9480] Add snapshot test for student list component #9582
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.
Add cases for :-
enableRemindButton
set to true- student with
photoUrl
isAllowedToModifyStudent
set to true
b227b5c
to
7390a4f
Compare
Added the respective cases @AyushChatto |
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 as far the coverage is concerned. Had some qns about the snapshot though, but I might be wrong. Best to err on the side of caution I suppose.
src/web/app/pages-instructor/student-list/__snapshots__/student-list.component.spec.ts.snap
Show resolved
Hide resolved
</tm-student-list> | ||
`; | ||
|
||
exports[`StudentListComponent should snap with enable remind button set to true and one student yet to join 1`] = ` |
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.
Really minor nit, but there's actually two students that are yet to join.
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.
Yup updated!
src/web/app/pages-instructor/student-list/__snapshots__/student-list.component.spec.ts.snap
Show resolved
Hide resolved
</tm-student-list> | ||
`; | ||
|
||
exports[`StudentListComponent should snap with some student list data and some students to hide 1`] = ` |
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.
Next time, make life easier for reviewers by giving the hidden students names like 'This should not be displayed' :(
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.
Well, I am not writing this test to make life easier for reviewers. I have fed in data that you are more likely to see in production for this application. I have preferably tried to make it as real as possible (so we are more likely to catch bugs).
As a reviewer, you could have looked out for:
component.listOfStudentsToHide = [
'alice.b.tmms@gmail.tmt',
'tester@tester.com',
];
From there you would have to make sure that the student with this email, is not going to be present in this snapshot.
It is definitely a little bit more work and I agree that names like 'This should not be displayed' would have made things a little faster (its also not super critical to have names like Alice). I can change this if you prefer but personally, I would stick to data that is as close to production if I could.
If you follow a pattern like this, you may end up compromising the quality of your tests at some point..but again this is just my own opinion! I am okay either way :)
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.
Just basing it off #9605 - I haven't traditionally follow it either, but I kinda see the merit in it. No worries, this is fine, just for future reference anyway :)
7390a4f
to
a209af9
Compare
I have improved as per the suggestions. @AyushChatto have a look when you have time. |
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 :)
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 #9480
Added some test cases for the student list component.
No data
Populate with data
Check if data has sections
Check with some fields hidden