feat: add pause and delete actions for users
This commit is contained in:
@@ -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();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user