cryostatio / cryostatio/cryostat-web
[Task] Fix tests' warnings on missing wrapping act
- Dominant language
- TypeScript
- Stars
- 13
- Forks
- 21
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 42
Description
Starting to see these similar warnings in many places in tests:
```bash
console.error
Warning: An update to Popper inside a test was not wrapped in act(...).
When testing, code that causes React state updates should be wrapped into act(...):
act(() => {
/* fire events that update state */
});
/* assert on the output */
This ensures that you're testing the behavior the user would see in the browser. Learn more at https://reactjs.org/link/wrap-tests-with-act
at Popper (/home/thvo/workspace/cryostat-web/node_modules/@patternfly/react-core/dist/js/helpers/Popper/Popper.js:28:26)
at GenerateId (/home/thvo/workspace/cryostat-web/node_modules/@patternfly/react-core/dist/js/helpers/GenerateId/GenerateId.js:20:5)
at Select (/home/thvo/workspace/cryostat-web/node_modules/@patternfly/react-core/dist/js/components/Select/Select.js:33:5)
at Component (/home/thvo/workspace/cryostat-web/src/app/Settings/CredentialsStorage.tsx:75:43)
at Wrapper (/home/thvo/workspace/cryostat-web/src/test/Common.tsx:59:30)
```
Seem to affect tests on component that has a Popper in its sub-tree. Maybe some deps upgrade update Popper somewhere?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the warning in tests for components containing PatternFly Popper, using the stack-trace locations in src/app/Settings/CredentialsStorage.tsx and src/test/Common.tsx as entry points. Trace which test interactions trigger the update and verify that the relevant tests complete without missing-act warnings while preserving their existing assertions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100