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

Add JavaScript tests for the PhoneNumberCard component #2027

Merged
merged 2 commits into from
Jul 31, 2023

Conversation

eason9487
Copy link
Member

Changes proposed in this Pull Request:

This is a part of 📌 Add tests in #1993.

Before adding tests for the VerifyPhoneNumberContent component, I would like to add tests for the PhoneNumberCard component first.

Detailed test instructions:

  1. Check if the newly added tests fit with the test purpose.
  2. Check if all JS tests can pass.

Changelog entry

@eason9487 eason9487 requested a review from a team July 28, 2023 12:07
@eason9487 eason9487 self-assigned this Jul 28, 2023
@github-actions github-actions bot added the changelog: dev Developer-facing only change. label Jul 28, 2023
Comment on lines +100 to +103
mockLoaded( false );
const { rerender } = render(
<PhoneNumberCard phoneNumber={ phoneNumber } />
);
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this can be omitted.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is to simulate the state change of "after loading a verified phone number".

expect( button ).not.toBeInTheDocument();
} );

it( 'When `initEditing` is not specified, should render in display mode after loading a verified phone number', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

"display mode" doesn't explain much. I guess it would be more accurate to say

should render the edit button after loading a verified phone number

Copy link
Member Author

Choose a reason for hiding this comment

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

The mode for entering verification code also has an edit button. Changed to use "non-editing mode" in ca7ce02.

image

Comment on lines +114 to +117
mockLoaded( false );
const { rerender } = render(
<PhoneNumberCard phoneNumber={ phoneNumber } />
);
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess same as before, this seems not necessary

Copy link
Member Author

Choose a reason for hiding this comment

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

This is to simulate the state change of "after loading an unverified phone number".

Copy link
Contributor

@puntope puntope left a comment

Choose a reason for hiding this comment

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

✅ LGTM

Tests pass and seem to cover all the scenarios.

@eason9487 eason9487 merged commit 829660b into develop Jul 31, 2023
4 checks passed
@eason9487 eason9487 deleted the dev/1993-js-test-phone-number-card branch July 31, 2023 03:54
@martynmjones martynmjones mentioned this pull request Aug 1, 2023
17 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: dev Developer-facing only change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants