45 lines
4.5 KiB
Plaintext
45 lines
4.5 KiB
Plaintext
|
|
> job-tracker-ui@0.1.0 test
|
|
> jest --runInBand admin-users-page.test.tsx
|
|
|
|
console.error
|
|
An update to AdminUsersPage 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://react.dev/link/wrap-tests-with-act
|
|
|
|
79 | return () => { checkSessionCookie(); return lifetime.mounted && lifetime.generation===generation && !isSessionInvalidated() && getSessionContext()===context; };
|
|
80 | }, []);
|
|
> 81 | const finishAction=useCallback((active: () => boolean) => { owner.current.busy=false; if (active()) setBusy(false); }, []);
|
|
| ^
|
|
82 |
|
|
83 | const createUser=async () => {
|
|
84 | if (!canCreate) return;
|
|
|
|
at node_modules/react-dom/cjs/react-dom-client.development.js:18758:19
|
|
at runWithFiberInDEV (node_modules/react-dom/cjs/react-dom-client.development.js:874:13)
|
|
at warnIfUpdatesNotWrappedWithActDEV (node_modules/react-dom/cjs/react-dom-client.development.js:18757:9)
|
|
at scheduleUpdateOnFiber (node_modules/react-dom/cjs/react-dom-client.development.js:16409:11)
|
|
at dispatchSetStateInternal (node_modules/react-dom/cjs/react-dom-client.development.js:9170:13)
|
|
at dispatchSetState (node_modules/react-dom/cjs/react-dom-client.development.js:9127:7)
|
|
at setBusy (src/views/AdminUsersPage.tsx:81:103)
|
|
at finishAction (src/views/AdminUsersPage.tsx:136:15)
|
|
|
|
node.exe : Test Suites: 1 passed, 1 total
|
|
At line:1 char:1
|
|
+ & "C:\Program Files\nodejs/node.exe" "C:\Program Files\nodejs/node_mo ...
|
|
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
+ CategoryInfo : NotSpecified: (Test Suites: 1 passed, 1 total:String) [], RemoteException
|
|
+ FullyQualifiedErrorId : NativeCommandError
|
|
|
|
Tests: 14 passed, 14 total
|
|
Snapshots: 0 total
|
|
Time: 9.656 s, estimated 14 s
|
|
Ran all test suites matching admin-users-page.test.tsx.
|