-
Notifications
You must be signed in to change notification settings - Fork 46
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
Nanguan Add test for CreateNewBadgePopup.jsx #3027
base: development
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for highestgoodnetwork-dev ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
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.
Hi Nanguan,
Great job on the PR! The tests for CreateNewBadgePopup are well-structured and cover key functionality like rendering, conditional fields, form validation, and data submission. I appreciate how you used jest.mock for action handling and fireEvent for simulating user interactions. One suggestion would be to explore edge cases like unexpected inputs or API failures to make the coverage even more robust. Overall, this is a solid contribution—nice work!
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.
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.
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.
replace #2894
Test following as requested by #2894 (review)
Render Verification:
Add assertions for all key elements (e.g., input fields, dropdowns, buttons) to ensure they render correctly. Verifying just the "create" button alone isn't adequate
Conditional Logic:
Test visibility of fields that appear or change based on the selected badge type (e.g., showTotalHrs, showWeeks).
Button State:
Verify the "Create" button is enabled or disabled based on input validity.
Form Submission:
Mock the createNewBadge function and verify it is called with the correct data on form submission.
result
cc @KurtisIvey