FAIL src/admin-users-page.test.tsx (13.331 s)
  ● Console

    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

      146 |     return () => { checkSessionCookie(); return lifetime.mounted && lifetime.generation===generation && !isSessionInvalidated() && getSessionContext()===context; };
      147 |   }, []);
    > 148 |   const finishAction=useCallback((active: () => boolean) => { owner.current.busy=false; if (active()) setBusy(false); }, []);
          |                                                                                                       ^
      149 |
      150 |   const createUser=async () => {
      151 |     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:148:103)
      at finishAction (src/views/AdminUsersPage.tsx:203:15)

  ● pending admin confirmation mobile=true demote self follows en to nb without applying it

    expect(jest.fn()).toHaveBeenCalledTimes(expected)

    Expected number of calls: 1
    Received number of calls: 2

      83 |   expect(within(opened).getByRole('button', { name: translations[to][demote ? 'adminUsersRemoveAdmin' : 'adminUsersDelete'] })).toBeVisible();
      84 |   expect(cancel).toHaveFocus();
    > 85 |   expect(mockedApi.get).toHaveBeenCalledTimes(reads);
         |                         ^
      86 |   expect(mockedApi.put).not.toHaveBeenCalled(); expect(mockedApi.delete).not.toHaveBeenCalled();
      87 |   fireEvent.click(within(opened).getByRole('button', { name: translations[to].cancel }));
      88 |   await waitFor(() => expect(screen.queryByRole('dialog')).not.toBeInTheDocument());

      at toHaveBeenCalledTimes (src/admin-users-page.test.tsx:85:25)

  ● pending admin confirmation mobile=true demote self follows nb to en without applying it

    expect(jest.fn()).toHaveBeenCalledTimes(expected)

    Expected number of calls: 1
    Received number of calls: 2

      83 |   expect(within(opened).getByRole('button', { name: translations[to][demote ? 'adminUsersRemoveAdmin' : 'adminUsersDelete'] })).toBeVisible();
      84 |   expect(cancel).toHaveFocus();
    > 85 |   expect(mockedApi.get).toHaveBeenCalledTimes(reads);
         |                         ^
      86 |   expect(mockedApi.put).not.toHaveBeenCalled(); expect(mockedApi.delete).not.toHaveBeenCalled();
      87 |   fireEvent.click(within(opened).getByRole('button', { name: translations[to].cancel }));
      88 |   await waitFor(() => expect(screen.queryByRole('dialog')).not.toBeInTheDocument());

      at toHaveBeenCalledTimes (src/admin-users-page.test.tsx:85:25)

  ● pending admin confirmation mobile=true demote other follows en to nb without applying it

    expect(jest.fn()).toHaveBeenCalledTimes(expected)

    Expected number of calls: 1
    Received number of calls: 2

      83 |   expect(within(opened).getByRole('button', { name: translations[to][demote ? 'adminUsersRemoveAdmin' : 'adminUsersDelete'] })).toBeVisible();
      84 |   expect(cancel).toHaveFocus();
    > 85 |   expect(mockedApi.get).toHaveBeenCalledTimes(reads);
         |                         ^
      86 |   expect(mockedApi.put).not.toHaveBeenCalled(); expect(mockedApi.delete).not.toHaveBeenCalled();
      87 |   fireEvent.click(within(opened).getByRole('button', { name: translations[to].cancel }));
      88 |   await waitFor(() => expect(screen.queryByRole('dialog')).not.toBeInTheDocument());

      at toHaveBeenCalledTimes (src/admin-users-page.test.tsx:85:25)

  ● pending admin confirmation mobile=true demote other follows nb to en without applying it

    expect(jest.fn()).toHaveBeenCalledTimes(expected)

    Expected number of calls: 1
    Received number of calls: 2

      83 |   expect(within(opened).getByRole('button', { name: translations[to][demote ? 'adminUsersRemoveAdmin' : 'adminUsersDelete'] })).toBeVisible();
      84 |   expect(cancel).toHaveFocus();
    > 85 |   expect(mockedApi.get).toHaveBeenCalledTimes(reads);
         |                         ^
      86 |   expect(mockedApi.put).not.toHaveBeenCalled(); expect(mockedApi.delete).not.toHaveBeenCalled();
      87 |   fireEvent.click(within(opened).getByRole('button', { name: translations[to].cancel }));
      88 |   await waitFor(() => expect(screen.queryByRole('dialog')).not.toBeInTheDocument());

      at toHaveBeenCalledTimes (src/admin-users-page.test.tsx:85:25)

  ● pending admin confirmation mobile=true delete self follows en to nb without applying it

    expect(jest.fn()).toHaveBeenCalledTimes(expected)

    Expected number of calls: 1
    Received number of calls: 2

      83 |   expect(within(opened).getByRole('button', { name: translations[to][demote ? 'adminUsersRemoveAdmin' : 'adminUsersDelete'] })).toBeVisible();
      84 |   expect(cancel).toHaveFocus();
    > 85 |   expect(mockedApi.get).toHaveBeenCalledTimes(reads);
         |                         ^
      86 |   expect(mockedApi.put).not.toHaveBeenCalled(); expect(mockedApi.delete).not.toHaveBeenCalled();
      87 |   fireEvent.click(within(opened).getByRole('button', { name: translations[to].cancel }));
      88 |   await waitFor(() => expect(screen.queryByRole('dialog')).not.toBeInTheDocument());

      at toHaveBeenCalledTimes (src/admin-users-page.test.tsx:85:25)

  ● pending admin confirmation mobile=true delete self follows nb to en without applying it

    expect(jest.fn()).toHaveBeenCalledTimes(expected)

    Expected number of calls: 1
    Received number of calls: 2

      83 |   expect(within(opened).getByRole('button', { name: translations[to][demote ? 'adminUsersRemoveAdmin' : 'adminUsersDelete'] })).toBeVisible();
      84 |   expect(cancel).toHaveFocus();
    > 85 |   expect(mockedApi.get).toHaveBeenCalledTimes(reads);
         |                         ^
      86 |   expect(mockedApi.put).not.toHaveBeenCalled(); expect(mockedApi.delete).not.toHaveBeenCalled();
      87 |   fireEvent.click(within(opened).getByRole('button', { name: translations[to].cancel }));
      88 |   await waitFor(() => expect(screen.queryByRole('dialog')).not.toBeInTheDocument());

      at toHaveBeenCalledTimes (src/admin-users-page.test.tsx:85:25)

  ● pending admin confirmation mobile=true delete other follows en to nb without applying it

    expect(jest.fn()).toHaveBeenCalledTimes(expected)

    Expected number of calls: 1
    Received number of calls: 2

      83 |   expect(within(opened).getByRole('button', { name: translations[to][demote ? 'adminUsersRemoveAdmin' : 'adminUsersDelete'] })).toBeVisible();
      84 |   expect(cancel).toHaveFocus();
    > 85 |   expect(mockedApi.get).toHaveBeenCalledTimes(reads);
         |                         ^
      86 |   expect(mockedApi.put).not.toHaveBeenCalled(); expect(mockedApi.delete).not.toHaveBeenCalled();
      87 |   fireEvent.click(within(opened).getByRole('button', { name: translations[to].cancel }));
      88 |   await waitFor(() => expect(screen.queryByRole('dialog')).not.toBeInTheDocument());

      at toHaveBeenCalledTimes (src/admin-users-page.test.tsx:85:25)

  ● pending admin confirmation mobile=true delete other follows nb to en without applying it

    expect(jest.fn()).toHaveBeenCalledTimes(expected)

    Expected number of calls: 1
    Received number of calls: 2

      83 |   expect(within(opened).getByRole('button', { name: translations[to][demote ? 'adminUsersRemoveAdmin' : 'adminUsersDelete'] })).toBeVisible();
      84 |   expect(cancel).toHaveFocus();
    > 85 |   expect(mockedApi.get).toHaveBeenCalledTimes(reads);
         |                         ^
      86 |   expect(mockedApi.put).not.toHaveBeenCalled(); expect(mockedApi.delete).not.toHaveBeenCalled();
      87 |   fireEvent.click(within(opened).getByRole('button', { name: translations[to].cancel }));
      88 |   await waitFor(() => expect(screen.queryByRole('dialog')).not.toBeInTheDocument());

      at toHaveBeenCalledTimes (src/admin-users-page.test.tsx:85:25)

  ● pending admin confirmation mobile=false demote self follows en to nb without applying it

    expect(jest.fn()).toHaveBeenCalledTimes(expected)

    Expected number of calls: 1
    Received number of calls: 2

      83 |   expect(within(opened).getByRole('button', { name: translations[to][demote ? 'adminUsersRemoveAdmin' : 'adminUsersDelete'] })).toBeVisible();
      84 |   expect(cancel).toHaveFocus();
    > 85 |   expect(mockedApi.get).toHaveBeenCalledTimes(reads);
         |                         ^
      86 |   expect(mockedApi.put).not.toHaveBeenCalled(); expect(mockedApi.delete).not.toHaveBeenCalled();
      87 |   fireEvent.click(within(opened).getByRole('button', { name: translations[to].cancel }));
      88 |   await waitFor(() => expect(screen.queryByRole('dialog')).not.toBeInTheDocument());

      at toHaveBeenCalledTimes (src/admin-users-page.test.tsx:85:25)

  ● pending admin confirmation mobile=false demote self follows nb to en without applying it

    expect(jest.fn()).toHaveBeenCalledTimes(expected)

    Expected number of calls: 1
    Received number of calls: 2

      83 |   expect(within(opened).getByRole('button', { name: translations[to][demote ? 'adminUsersRemoveAdmin' : 'adminUsersDelete'] })).toBeVisible();
      84 |   expect(cancel).toHaveFocus();
    > 85 |   expect(mockedApi.get).toHaveBeenCalledTimes(reads);
         |                         ^
      86 |   expect(mockedApi.put).not.toHaveBeenCalled(); expect(mockedApi.delete).not.toHaveBeenCalled();
      87 |   fireEvent.click(within(opened).getByRole('button', { name: translations[to].cancel }));
      88 |   await waitFor(() => expect(screen.queryByRole('dialog')).not.toBeInTheDocument());

      at toHaveBeenCalledTimes (src/admin-users-page.test.tsx:85:25)

  ● pending admin confirmation mobile=false demote other follows en to nb without applying it

    expect(jest.fn()).toHaveBeenCalledTimes(expected)

    Expected number of calls: 1
    Received number of calls: 2

      83 |   expect(within(opened).getByRole('button', { name: translations[to][demote ? 'adminUsersRemoveAdmin' : 'adminUsersDelete'] })).toBeVisible();
      84 |   expect(cancel).toHaveFocus();
    > 85 |   expect(mockedApi.get).toHaveBeenCalledTimes(reads);
         |                         ^
      86 |   expect(mockedApi.put).not.toHaveBeenCalled(); expect(mockedApi.delete).not.toHaveBeenCalled();
      87 |   fireEvent.click(within(opened).getByRole('button', { name: translations[to].cancel }));
      88 |   await waitFor(() => expect(screen.queryByRole('dialog')).not.toBeInTheDocument());

      at toHaveBeenCalledTimes (src/admin-users-page.test.tsx:85:25)

  ● pending admin confirmation mobile=false demote other follows nb to en without applying it

    expect(jest.fn()).toHaveBeenCalledTimes(expected)

    Expected number of calls: 1
    Received number of calls: 2

      83 |   expect(within(opened).getByRole('button', { name: translations[to][demote ? 'adminUsersRemoveAdmin' : 'adminUsersDelete'] })).toBeVisible();
      84 |   expect(cancel).toHaveFocus();
    > 85 |   expect(mockedApi.get).toHaveBeenCalledTimes(reads);
         |                         ^
      86 |   expect(mockedApi.put).not.toHaveBeenCalled(); expect(mockedApi.delete).not.toHaveBeenCalled();
      87 |   fireEvent.click(within(opened).getByRole('button', { name: translations[to].cancel }));
      88 |   await waitFor(() => expect(screen.queryByRole('dialog')).not.toBeInTheDocument());

      at toHaveBeenCalledTimes (src/admin-users-page.test.tsx:85:25)

  ● pending admin confirmation mobile=false delete self follows en to nb without applying it

    expect(jest.fn()).toHaveBeenCalledTimes(expected)

    Expected number of calls: 1
    Received number of calls: 2

      83 |   expect(within(opened).getByRole('button', { name: translations[to][demote ? 'adminUsersRemoveAdmin' : 'adminUsersDelete'] })).toBeVisible();
      84 |   expect(cancel).toHaveFocus();
    > 85 |   expect(mockedApi.get).toHaveBeenCalledTimes(reads);
         |                         ^
      86 |   expect(mockedApi.put).not.toHaveBeenCalled(); expect(mockedApi.delete).not.toHaveBeenCalled();
      87 |   fireEvent.click(within(opened).getByRole('button', { name: translations[to].cancel }));
      88 |   await waitFor(() => expect(screen.queryByRole('dialog')).not.toBeInTheDocument());

      at toHaveBeenCalledTimes (src/admin-users-page.test.tsx:85:25)

  ● pending admin confirmation mobile=false delete self follows nb to en without applying it

    expect(jest.fn()).toHaveBeenCalledTimes(expected)

    Expected number of calls: 1
    Received number of calls: 2

      83 |   expect(within(opened).getByRole('button', { name: translations[to][demote ? 'adminUsersRemoveAdmin' : 'adminUsersDelete'] })).toBeVisible();
      84 |   expect(cancel).toHaveFocus();
    > 85 |   expect(mockedApi.get).toHaveBeenCalledTimes(reads);
         |                         ^
      86 |   expect(mockedApi.put).not.toHaveBeenCalled(); expect(mockedApi.delete).not.toHaveBeenCalled();
      87 |   fireEvent.click(within(opened).getByRole('button', { name: translations[to].cancel }));
      88 |   await waitFor(() => expect(screen.queryByRole('dialog')).not.toBeInTheDocument());

      at toHaveBeenCalledTimes (src/admin-users-page.test.tsx:85:25)

  ● pending admin confirmation mobile=false delete other follows en to nb without applying it

    expect(jest.fn()).toHaveBeenCalledTimes(expected)

    Expected number of calls: 1
    Received number of calls: 2

      83 |   expect(within(opened).getByRole('button', { name: translations[to][demote ? 'adminUsersRemoveAdmin' : 'adminUsersDelete'] })).toBeVisible();
      84 |   expect(cancel).toHaveFocus();
    > 85 |   expect(mockedApi.get).toHaveBeenCalledTimes(reads);
         |                         ^
      86 |   expect(mockedApi.put).not.toHaveBeenCalled(); expect(mockedApi.delete).not.toHaveBeenCalled();
      87 |   fireEvent.click(within(opened).getByRole('button', { name: translations[to].cancel }));
      88 |   await waitFor(() => expect(screen.queryByRole('dialog')).not.toBeInTheDocument());

      at toHaveBeenCalledTimes (src/admin-users-page.test.tsx:85:25)

  ● pending admin confirmation mobile=false delete other follows nb to en without applying it

    expect(jest.fn()).toHaveBeenCalledTimes(expected)

    Expected number of calls: 1
    Received number of calls: 2

      83 |   expect(within(opened).getByRole('button', { name: translations[to][demote ? 'adminUsersRemoveAdmin' : 'adminUsersDelete'] })).toBeVisible();
      84 |   expect(cancel).toHaveFocus();
    > 85 |   expect(mockedApi.get).toHaveBeenCalledTimes(reads);
         |                         ^
      86 |   expect(mockedApi.put).not.toHaveBeenCalled(); expect(mockedApi.delete).not.toHaveBeenCalled();
      87 |   fireEvent.click(within(opened).getByRole('button', { name: translations[to].cancel }));
      88 |   await waitFor(() => expect(screen.queryByRole('dialog')).not.toBeInTheDocument());

      at toHaveBeenCalledTimes (src/admin-users-page.test.tsx:85:25)


Test Suites: 1 failed, 1 passed, 2 total
Tests:       16 failed, 24 passed, 40 total
Snapshots:   0 total
Time:        17.186 s
Ran all test suites matching src/admin-users-page.test.tsx|src/dialog-text.test.tsx|src/account-admin-presentation.test.tsx.
Test results written to: E:\Storage\Projects\Active\temp docs\jobjakt-local-build\admin-dialog-green.json
