This repository has been archived by the owner on Sep 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make usage of jest.mock for react-dom conform to defined behavior
This helps prepare for using Babel to transpile TypeScript but is good practice regardless. - In `code_intelligence.test.tsx`, the `jest.mock('react-dom', ...)` was rejected with a fatal error by Babel (in babel-jest) because it referred to an out-of-scope variable (for why it rejects this, see jestjs/jest#2567). Also, it was undefined behavior that the `jest.mock` of `react-dom` applied to other modules (see "...mocked only for the file that calls `jest.mock`..." at https://jestjs.io/docs/en/jest-object#jestmockmodulename-factory-options). So, this commit passes the `react-dom` `render` function as an argument to the functions under test to make mocking easier and fully explicit without the need for test harness magic. - Removes unnecessary mocking of `react-dom` in `text_fields.test.tsx`. The mock was never checked.
- Loading branch information
Showing
4 changed files
with
26 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters