Skip to content
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

test: migrate from enzyme to @testing-library/react #323

Merged
merged 11 commits into from
Apr 14, 2022

Conversation

100terres
Copy link
Collaborator

fix #318

@100terres 100terres added this to the React v18 milestone Apr 11, 2022
@100terres 100terres self-assigned this Apr 11, 2022
@100terres 100terres linked an issue Apr 11, 2022 that may be closed by this pull request
@100terres 100terres force-pushed the 318-migrate-from-enzyme-to-testing-library-react branch 2 times, most recently from 454cbc1 to 21f54c8 Compare April 13, 2022 04:03
src/state/create-store.ts Outdated Show resolved Hide resolved
test/tsconfig.json Outdated Show resolved Hide resolved
@100terres 100terres mentioned this pull request Apr 13, 2022
5 tasks
@100terres 100terres force-pushed the 318-migrate-from-enzyme-to-testing-library-react branch 3 times, most recently from 0cf0840 to 5dd5999 Compare April 14, 2022 02:10
@100terres 100terres force-pushed the 318-migrate-from-enzyme-to-testing-library-react branch from 5dd5999 to 26b69ab Compare April 14, 2022 02:41
@100terres 100terres force-pushed the 318-migrate-from-enzyme-to-testing-library-react branch from 26b69ab to d2005ff Compare April 14, 2022 02:55
Comment on lines +12 to +25
// Spy Placeholder component
jest.mock('../../../../src/view/placeholder', () => jest.fn());
// eslint-disable-next-line import/newline-after-import, import/first
import _Placeholder from '../../../../src/view/placeholder';
const Placeholder = jest.mocked(_Placeholder);
const { default: OriginalPlaceholder } = jest.requireActual<{
default: typeof _Placeholder;
}>('../../../../src/view/placeholder');

beforeEach(() => {
Placeholder.mockImplementation((props: any) => {
return <OriginalPlaceholder {...props} />;
});
});
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

🤯

@100terres 100terres marked this pull request as ready for review April 14, 2022 03:05
@100terres 100terres merged commit 5bfd335 into react-18 Apr 14, 2022
@100terres 100terres deleted the 318-migrate-from-enzyme-to-testing-library-react branch April 14, 2022 03:05
100terres added a commit that referenced this pull request Aug 21, 2022
* test(dev-deps): remove enzyme libraries from package.json

* test(setup): remove enzyme related configuration

* test: move REACT_VERSION global declaration

* test(dev-deps): setup @testing-library/jest-dom

for more details see: https://github.com/testing-library/jest-dom#usage=

* test(jsdom env): fix issue with missing TransitionEvent

* test(enzyme): drop Placeholder without memo (needed for enzyme)

* test(enzyme): drop force upfate util

* test(enzyme): drop PassThroughProps util component

Not needed anymore, because with @testing-library/react there are no equivalent to the `setProp`. We
must use the `rerender` function and we can directly change the prop of child component in the tree
if needed.

* test(util): drop un-used user input util

* test(enzyme): migrate all tests using enzyme to @testing-library/react

* chore: bump size snapshot
100terres added a commit that referenced this pull request Aug 21, 2022
* test(dev-deps): remove enzyme libraries from package.json

* test(setup): remove enzyme related configuration

* test: move REACT_VERSION global declaration

* test(dev-deps): setup @testing-library/jest-dom

for more details see: https://github.com/testing-library/jest-dom#usage=

* test(jsdom env): fix issue with missing TransitionEvent

* test(enzyme): drop Placeholder without memo (needed for enzyme)

* test(enzyme): drop force upfate util

* test(enzyme): drop PassThroughProps util component

Not needed anymore, because with @testing-library/react there are no equivalent to the `setProp`. We
must use the `rerender` function and we can directly change the prop of child component in the tree
if needed.

* test(util): drop un-used user input util

* test(enzyme): migrate all tests using enzyme to @testing-library/react

* chore: bump size snapshot
100terres added a commit that referenced this pull request Aug 21, 2022
* test(dev-deps): remove enzyme libraries from package.json

* test(setup): remove enzyme related configuration

* test: move REACT_VERSION global declaration

* test(dev-deps): setup @testing-library/jest-dom

for more details see: https://github.com/testing-library/jest-dom#usage=

* test(jsdom env): fix issue with missing TransitionEvent

* test(enzyme): drop Placeholder without memo (needed for enzyme)

* test(enzyme): drop force upfate util

* test(enzyme): drop PassThroughProps util component

Not needed anymore, because with @testing-library/react there are no equivalent to the `setProp`. We
must use the `rerender` function and we can directly change the prop of child component in the tree
if needed.

* test(util): drop un-used user input util

* test(enzyme): migrate all tests using enzyme to @testing-library/react

* chore: bump size snapshot
100terres added a commit that referenced this pull request Aug 21, 2022
* test(dev-deps): remove enzyme libraries from package.json

* test(setup): remove enzyme related configuration

* test: move REACT_VERSION global declaration

* test(dev-deps): setup @testing-library/jest-dom

for more details see: https://github.com/testing-library/jest-dom#usage=

* test(jsdom env): fix issue with missing TransitionEvent

* test(enzyme): drop Placeholder without memo (needed for enzyme)

* test(enzyme): drop force upfate util

* test(enzyme): drop PassThroughProps util component

Not needed anymore, because with @testing-library/react there are no equivalent to the `setProp`. We
must use the `rerender` function and we can directly change the prop of child component in the tree
if needed.

* test(util): drop un-used user input util

* test(enzyme): migrate all tests using enzyme to @testing-library/react

* chore: bump size snapshot
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.

Migrate from Enzyme to @testing-library/react
1 participant