Skip to content

Commit c59fd7b

Browse files
fusharclaude
andauthored
Admin: improve dialog test coverage (#888)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent e3f7edf commit c59fd7b

File tree

2 files changed

+6
-20
lines changed

2 files changed

+6
-20
lines changed

judgels-client/src/routes/admin/roles/RoleEditDialog/RoleEditDialog.test.jsx

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,31 +36,22 @@ describe('RoleEditDialog', () => {
3636
);
3737
};
3838

39-
test('renders the edit button', async () => {
40-
await renderComponent();
41-
expect(screen.getByRole('button', { name: /edit roles/i })).toBeInTheDocument();
42-
});
43-
44-
test('pre-fills the textarea with current roles', async () => {
39+
test('form', async () => {
4540
await renderComponent();
4641
const user = userEvent.setup();
4742

4843
await user.click(screen.getByRole('button', { name: /edit roles/i }));
4944

5045
const textarea = screen.getByRole('textbox');
5146
expect(textarea.value).toBe('andi,ADMIN,ADMIN,ADMIN,ADMIN\nbudi,,ADMIN,,');
52-
});
5347

54-
test('submits roles', async () => {
55-
await renderComponent();
56-
const user = userEvent.setup();
57-
58-
await user.click(screen.getByRole('button', { name: /edit roles/i }));
48+
await user.clear(textarea);
49+
await user.type(textarea, 'andi,ADMIN,ADMIN,,\ncaca,,ADMIN,,');
5950

6051
nockJophiel()
6152
.put('/user-roles', {
62-
andi: { jophiel: 'ADMIN', sandalphon: 'ADMIN', uriel: 'ADMIN', jerahmeel: 'ADMIN' },
63-
budi: { sandalphon: 'ADMIN' },
53+
andi: { jophiel: 'ADMIN', sandalphon: 'ADMIN' },
54+
caca: { sandalphon: 'ADMIN' },
6455
})
6556
.reply(200);
6657

judgels-client/src/routes/admin/users/UserUpsertDialog/UserUpsertDialog.test.jsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,7 @@ describe('UserUpsertDialog', () => {
2525
);
2626
};
2727

28-
test('renders the upsert button', async () => {
29-
await renderComponent();
30-
expect(screen.getByRole('button', { name: /upsert users/i })).toBeInTheDocument();
31-
});
32-
33-
test('submits CSV and renders results', async () => {
28+
test('form', async () => {
3429
await renderComponent();
3530
const user = userEvent.setup();
3631

0 commit comments

Comments
 (0)