Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Keep the sequential token consumer assertion readable

pulse-triage[bot]1dc1e5ce12d1
diff --git a/frontend-modern/src/components/Settings/__tests__/APITokenManager.test.tsx b/frontend-modern/src/components/Settings/__tests__/APITokenManager.test.tsx
index c987f34512..d52fb287d3 100644
--- a/frontend-modern/src/components/Settings/__tests__/APITokenManager.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/APITokenManager.test.tsx
@@ -899,22 +899,22 @@ describe('APITokenManager', () => {
scopes: [MONITORING_READ_SCOPE, SETTINGS_READ_SCOPE],
});
render(() => <APITokenManager canManage />);
- fireEvent.click(within(await findTokenTableRow('Sequential token')).getByRole('button', {
- name: 'Edit scopes',
- }));
+ const row = await findTokenTableRow('Sequential token');
+ fireEvent.click(within(row).getByRole('button', { name: 'Edit scopes' }));
const dialog = await screen.findByRole('dialog', { name: 'Edit API token scopes' });
fireEvent.click(within(dialog).getByRole('checkbox', { name: /^Settings \(read\)/ }));
fireEvent.click(within(dialog).getByRole('button', { name: 'Save scopes' }));
await waitFor(() => expect(screen.queryByRole('dialog')).not.toBeInTheDocument());
- fireEvent.click(within(getTokenTableRow('Sequential token')).getByRole('button', {
- name: 'Revoke',
- }));
+ const updatedRow = getTokenTableRow('Sequential token');
+ fireEvent.click(within(updatedRow).getByRole('button', { name: 'Revoke' }));
const revoke = await screen.findByRole('dialog', { name: 'Revoke API token' });
fireEvent.click(within(revoke).getByRole('button', { name: 'Revoke token' }));
- await waitFor(() => expect(deleteTokenMock).toHaveBeenCalledWith(
- token.id,
- expect.objectContaining({ expectedOrgID: 'default', signal: expect.any(AbortSignal) }),
- ));
+ await waitFor(() => {
+ expect(deleteTokenMock).toHaveBeenCalledWith(
+ token.id,
+ expect.objectContaining({ expectedOrgID: 'default', signal: expect.any(AbortSignal) }),
+ );
+ });
await screen.findByText(/No tokens yet/);
expect(updateTokenScopesMock).toHaveBeenCalledTimes(1);
expect(deleteTokenMock).toHaveBeenCalledTimes(1);