Skip to content

Fix JS test console warning #4242

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

Merged
merged 4 commits into from
May 19, 2025
Merged

Fix JS test console warning #4242

merged 4 commits into from
May 19, 2025

Conversation

Mayisha
Copy link
Contributor

@Mayisha Mayisha commented Apr 18, 2025

Changes proposed in this Pull Request:

This PR fixes the following two console warnings when JS tests are run locally.

Screenshot 2025-04-18 at 9 38 58 PM
Screenshot 2025-04-18 at 9 44 14 PM

Testing instructions

  • Run npm run test:js and confirm that there is no warning message.

@Mayisha Mayisha requested a review from Copilot April 18, 2025 15:50
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes two console warnings in JS tests by modifying the test setups in two test files.

  • In the promotional banner section test, the original window.location.reload function is preserved and restored after each test run.
  • In the display order customization notice test, the test callback is made asynchronous and the userEvent click is wrapped in an asynchronous act block to address timing concerns.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
client/settings/payment-settings/tests/promotional-banner-section.test.js Preserves and restores window.location.reload to avoid test warnings.
client/settings/display-order-customization-notice/tests/display-order-customization-notice.js Converts a test to async and wraps the userEvent.click in await act to address console warnings.

@Mayisha Mayisha requested review from a team and annemirasol and removed request for a team May 14, 2025 06:42
Copy link
Contributor

@annemirasol annemirasol left a comment

Choose a reason for hiding this comment

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

LGTM!

@Mayisha Mayisha merged commit f491ce5 into develop May 19, 2025
49 of 51 checks passed
@Mayisha Mayisha deleted the tweak/js-test-warning branch May 19, 2025 06:08
@daledupreez daledupreez added this to the 9.6.0 milestone Jun 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants