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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open

Fix JS test console warning #4242

wants to merge 1 commit into from

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

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

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.

1 participant