feat: add pause and delete actions for users

This commit is contained in:
2026-04-01 23:40:09 +03:00
parent 10f20c8aec
commit 5a2dc43a06
6 changed files with 194 additions and 10 deletions

View File

@@ -52,4 +52,40 @@ describe('App login gate', () => {
expect(screen.queryByRole('dialog', { name: /add user/i })).not.toBeInTheDocument();
});
it('pauses and resumes a user profile from the table', async () => {
const user = userEvent.setup();
render(<App />);
await loginIntoPanel(user);
await user.click(screen.getByRole('button', { name: /users/i }));
await user.click(screen.getAllByRole('button', { name: /pause/i })[0]);
expect(screen.getByText(/^paused$/i)).toBeInTheDocument();
expect(screen.getAllByRole('button', { name: /resume/i })).toHaveLength(1);
await user.click(screen.getByRole('button', { name: /resume/i }));
expect(screen.queryByText(/^paused$/i)).not.toBeInTheDocument();
});
it('confirms before deleting a user and removes the row after approval', async () => {
const user = userEvent.setup();
render(<App />);
await loginIntoPanel(user);
await user.click(screen.getByRole('button', { name: /users/i }));
expect(screen.getByText(/night-shift/i)).toBeInTheDocument();
await user.click(screen.getAllByRole('button', { name: /delete/i })[0]);
const dialog = screen.getByRole('dialog', { name: /delete user/i });
expect(dialog).toBeInTheDocument();
expect(within(dialog).getByText(/remove profile/i)).toBeInTheDocument();
await user.click(within(dialog).getByRole('button', { name: /delete user/i }));
expect(screen.queryByText(/night-shift/i)).not.toBeInTheDocument();
expect(screen.queryByRole('dialog', { name: /delete user/i })).not.toBeInTheDocument();
});
});