Files
Keith WilliamsGitHubDevin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
64dcf5d3f6 fix: add cleanup and mock embed-iframe to prevent test teardown leak (#26377)
* fix: add cleanup and mock embed-iframe to prevent test teardown leak

The CancelBooking.cancellationFee.test.tsx was causing an unhandled jsdom
exception during test teardown due to the @calcom/embed-core/embed-iframe
module scheduling timers that would fire after the jsdom environment was
destroyed.

Changes:
- Mock @calcom/embed-core/embed-iframe to prevent sdkActionManager from
  scheduling timers during tests
- Add afterEach cleanup to ensure React Testing Library properly cleans up
  between tests
- Remove unused React import

Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>

* fix: add afterAll cleanup to restore scrollIntoView and unmock embed-iframe

Add proper cleanup in afterAll to:
- Restore Element.prototype.scrollIntoView to its original value
- Call vi.unmock for embed-iframe to avoid polluting other tests in the same worker

This prevents cross-test pollution that was causing flaky 'Closing rpc while fetch was pending' errors in other test files running in the same Vitest worker.

Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>

* fix: add cleanup to TestFormDialog and defer imports in editLocation.handler tests

- TestFormDialog.test.tsx: Add fake timers and flush pending timers before cleanup
  to prevent Radix FocusScope setTimeout from firing after jsdom teardown
- editLocation.handler.test.ts: Remove top-level imports to prevent watchlist
  module loading during test collection (tests are already skipped)

Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>

* fix: defer imports in confirm.handler.test.ts to prevent Salesforce GraphQL module loading

Tests are already skipped, so imports are not needed during collection phase.
This prevents 'Closing rpc while fetch was pending' errors from Salesforce GraphQL module imports.

Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-01-02 00:10:55 +00:00
..