Skip to content
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 #2894

Closed
wants to merge 19 commits into from

Conversation

lng2020
Copy link
Contributor

@lng2020 lng2020 commented Nov 24, 2024

Description

Add unit test for CreateNewBadgePopup.jsx

Main changes explained:

Added a new file under reducers/tests called CreateNewBadgePopup.test.js
Test the following scenarios:

  1. Rendering the component without crashing.
  2. Updating the state when the badge name input changes.
  3. Updating the state when the image URL input changes.
  4. Updating the state when the description input changes.
  5. Updating the state when the ranking input changes.
  6. Updating the state when the badge type select changes.

How to test:

  1. Checkout the current branch
  2. Run npm test CreateNewBadgePopup.test.js
  3. Verify all test cases pass without any errors

Screenshots or videos of changes:

Screenshot_20241123_230009

Copy link

netlify bot commented Nov 24, 2024

Deploy Preview for highestgoodnetwork-dev failed.

Name Link
🔨 Latest commit e5c481d
🔍 Latest deploy log https://app.netlify.com/sites/highestgoodnetwork-dev/deploys/677fa76093339200085033fe

Copy link

@RashmiKY98 RashmiKY98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified the test case and ensure that the test cases run and covers boundary scenario.
Screenshot 2024-11-23 232107

@chappdev2019
Copy link
Member

All tests passed, good work!

image

@SatyashanthiT
Copy link
Contributor

Tested the CreateNewBadgePopup component unit tests. Verified all scenarios, including input updates for badge name, image URL, description, ranking, and badge type.

image

@beblicarl beblicarl self-requested a review November 29, 2024 11:59
@beblicarl
Copy link
Contributor

All tests passed successfully and the code is great

image

beblicarl
beblicarl previously approved these changes Nov 29, 2024
Copy link

@nikhilpittala16 nikhilpittala16 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tested the PR and all the test cases have passed.
Screenshot (252)

jinxyou
jinxyou previously approved these changes Nov 30, 2024
Copy link
Contributor

@jinxyou jinxyou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test cases passed. Great job
Screenshot 2024-11-30 005746

@chappdev2019
Copy link
Member

All tests passed successfully

image

@anirudhsk2107 anirudhsk2107 self-requested a review December 4, 2024 02:19
anirudhsk2107
anirudhsk2107 previously approved these changes Dec 4, 2024
Copy link
Contributor

@anirudhsk2107 anirudhsk2107 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All test cases are working
Screen Shot 2024-12-03 at 9 20 57 PM

Lakshan-K
Lakshan-K previously approved these changes Dec 15, 2024
Copy link

@Lakshan-K Lakshan-K left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested the functionality described in this PR, and it works as expected.

All test cases in CreateNewBadgePopup.test.js passed successfully without any errors.

Verified that the component renders without crashing and the state updates correctly for all scenarios, including:
Badge name input changes.
Image URL input changes.
Description input changes.
Ranking input changes.
Badge type selection changes.

Great work on adding comprehensive unit tests for this component!

PR#2894

neha3010
neha3010 previously approved these changes Dec 21, 2024
Copy link
Contributor

@neha3010 neha3010 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the test cases passed.
Screenshot 2024-12-21 at 2 46 17 PM

Copy link
Contributor

@KurtisIvey KurtisIvey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi there, you've done great work so far on this test file, but I'm going to request changes for the following reasons.

  1. 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

  2. Conditional Logic:
    Test visibility of fields that appear or change based on the selected badge type (e.g., showTotalHrs, showWeeks).

  3. Button State:
    Verify the "Create" button is enabled or disabled based on input validity.

  4. Form Submission:
    Mock the createNewBadge function and verify it is called with the correct data on form submission.

Once these tests are modified/added you'll have my approval.

@lng2020
Copy link
Contributor Author

lng2020 commented Jan 9, 2025

replace by #3027

@lng2020 lng2020 closed this Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.