justinpark commented on code in PR #23760:
URL: https://github.com/apache/superset/pull/23760#discussion_r1179756195
##########
superset-frontend/src/hooks/apiResources/tables.test.ts:
##########
@@ -108,19 +109,20 @@ describe('useTables hook', () => {
})}`,
).length,
).toBe(1);
- expect(result.current.data).toEqual(expectedData);
- await act(async () => {
+ act(() => {
Review Comment:
yes. it's recommended.
```
console.error
Warning: An update to TestComponent 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://fb.me/react-wrap-tests-with-act
in TestComponent
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]