Skip to content

Fraud Protection: Stub form.submit globally in JS test setup#36

Merged
luizreis merged 1 commit intotrunkfrom
woosubs-1522-woofraudprotection-js-tests-emit-jsdom-not-implemented
Mar 12, 2026
Merged

Fraud Protection: Stub form.submit globally in JS test setup#36
luizreis merged 1 commit intotrunkfrom
woosubs-1522-woofraudprotection-js-tests-emit-jsdom-not-implemented

Conversation

@luizreis
Copy link
Contributor

@luizreis luizreis commented Mar 12, 2026

Changes proposed in this Pull Request

  • Add a Jest setupFilesAfterEnv file (tests/js/setup.js) that stubs HTMLFormElement.prototype.submit in beforeEach, suppressing jsdom "Not implemented" console errors across all JS test suites
  • Remove per-test form.submit spy overrides in add-payment-method.test.js, pay-for-order.test.js, and shortcode-checkout.test.js, asserting directly on the globally-stubbed form.submit instead

Closes WOOSUBS-1522

How to test the changes in this Pull Request

npm run test:js passes with no console errors.

Add a Jest setupFilesAfterEnv file that stubs HTMLFormElement.prototype.submit
to suppress jsdom "Not implemented" console errors across all test suites.
Remove per-test form.submit spy overrides that are no longer needed.

Closes WOOSUBS-1522
@luizreis luizreis force-pushed the woosubs-1522-woofraudprotection-js-tests-emit-jsdom-not-implemented branch from 615fc93 to fc59286 Compare March 12, 2026 20:14
@luizreis luizreis merged commit 508eec9 into trunk Mar 12, 2026
18 checks passed
@luizreis luizreis deleted the woosubs-1522-woofraudprotection-js-tests-emit-jsdom-not-implemented branch March 12, 2026 20:18
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