-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[React@18] Fix remaining unit tests #207195
base: main
Are you sure you want to change the base?
Conversation
return { | ||
...origin, | ||
useDispatch: jest.fn(), | ||
useDispatch: jest.fn(() => mockDispatch), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
return prevTimelineTypes; | ||
}); | ||
setTimelineTypes(tabId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes
Given the failed test, it seems there was a genuine runtime bug with React@18. It appears that the behavior of this pattern has changed in React@18 compared to React@17. I suspect that the original logic was lost over several refactorings and there is no need to nest setState in the same setState anymore, but please doublecheck
Pinging @elastic/appex-sharedux (Team:SharedUX) |
security-threat-hunting-investigations
await waitFor(async () => { | ||
await expect(findAllByTestId('trustedAppsListPage-card')).resolves.toHaveLength(10); | ||
expect(getAllByTestId('trustedAppsListPage-card')).toHaveLength(10); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DW changes LGTM, thanks for addressing this!
💚 Build Succeeded
Metrics [docs]Async chunks
|
Summary
Part of #206952
Fixes remaining unit tests that are failing with React@18
The idea is that tests should pass with both React 17 and 18. To run a unit tests with React@18: