This commit is contained in:
@@ -303,3 +303,60 @@ it('copies selected archived chat evidence separately from staff notes', async (
|
||||
evidence: { matchId: 17, message: 'abusive message' }
|
||||
});
|
||||
});
|
||||
|
||||
it('opens a newly created case page after preserving selected evidence', async () => {
|
||||
const fetch = vi
|
||||
.fn()
|
||||
.mockResolvedValue(new Response(JSON.stringify({ ok: true, id: 'new-case' })));
|
||||
vi.stubGlobal('fetch', fetch);
|
||||
show();
|
||||
button('Open case').click();
|
||||
await tick();
|
||||
const inputs = document.querySelectorAll<HTMLInputElement>('dialog input');
|
||||
enter(inputs[inputs.length - 1], 'Appeal review');
|
||||
submitDialog();
|
||||
await vi.waitFor(() =>
|
||||
expect(navigation.goto).toHaveBeenCalledWith('/moderation/cases/new-case', {
|
||||
invalidateAll: true
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
it('links case records to workspaces and preserves case filters while paging', () => {
|
||||
const data = overview('cases');
|
||||
data.query = { ...data.query, caseStatus: 'active', priority: 'high', assignedTo: 'me' };
|
||||
data.cases = [
|
||||
{
|
||||
id: 'case-1',
|
||||
game: 't5',
|
||||
guid,
|
||||
title: 'Chat investigation',
|
||||
status: 'escalated',
|
||||
priority: 'high',
|
||||
assigneeId: 'staff-1',
|
||||
assignee: 'Moderator',
|
||||
actor: 'Reporter',
|
||||
createdAt: '2026-10-15T12:00:00Z',
|
||||
updatedAt: '2026-10-16T12:00:00Z',
|
||||
revision: 3,
|
||||
evidence: []
|
||||
}
|
||||
];
|
||||
data.total = 40;
|
||||
show(data, 'moderator', '&caseStatus=active&priority=high&assignedTo=me');
|
||||
expect(document.querySelector('a[href="/moderation/cases/case-1"]')?.textContent).toBe(
|
||||
'Chat investigation'
|
||||
);
|
||||
expect(document.querySelector('#moderation-results')?.textContent).toContain('Escalated');
|
||||
expect(document.querySelector('#moderation-results')?.textContent).toContain('Moderator');
|
||||
button('Next').click();
|
||||
const destination = new URL(navigation.goto.mock.calls.at(-1)![0], 'http://localhost');
|
||||
expect(destination.searchParams.get('caseStatus')).toBe('active');
|
||||
expect(destination.searchParams.get('priority')).toBe('high');
|
||||
expect(destination.searchParams.get('assignedTo')).toBe('me');
|
||||
expect(destination.searchParams.get('offset')).toBe('25');
|
||||
button('Reset').click();
|
||||
const reset = new URL(navigation.goto.mock.calls.at(-1)![0], 'http://localhost');
|
||||
for (const filter of ['caseStatus', 'priority', 'assignedTo', 'offset'])
|
||||
expect(reset.searchParams.has(filter)).toBe(false);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user