Add structured moderation assessments with revision history
This commit is contained in:
@@ -67,3 +67,36 @@ it('filters case queues by workflow, priority and ownership while prioritizing a
|
||||
).total
|
||||
).toBe(1);
|
||||
});
|
||||
|
||||
it('shows the latest assessment in case queues while preserving earlier findings', async () => {
|
||||
const { mutateModeration } = await import('../../src/lib/server/moderation/actions.js');
|
||||
const { moderationOverview, moderationQuery } =
|
||||
await import('../../src/lib/server/moderation/overview.js');
|
||||
const { moderationCaseDetail } = await import('../../src/lib/server/moderation/cases.js');
|
||||
const mutate = (input: Record<string, unknown>) =>
|
||||
mutateModeration('first', { ...input, idempotencyKey: randomUUID() });
|
||||
const { id } = mutate({
|
||||
op: 'create-case',
|
||||
game: 't5',
|
||||
guid: '123',
|
||||
title: 'Conversation review'
|
||||
});
|
||||
for (const [revision, finding, summary] of [
|
||||
[1, 'inconclusive', 'Need more context'],
|
||||
[2, 'substantiated', 'Full excerpt confirms targeted harassment']
|
||||
] as const)
|
||||
mutate({
|
||||
op: 'assess-case',
|
||||
id,
|
||||
revision,
|
||||
summary,
|
||||
rules: ['Respect other players'],
|
||||
findings: [{ category: 'harassment', finding, detail: summary }]
|
||||
});
|
||||
const queue = moderationOverview('first', moderationQuery(new URLSearchParams('view=cases')));
|
||||
expect(queue.cases[0].assessment).toMatchObject({
|
||||
summary: 'Full excerpt confirms targeted harassment',
|
||||
findings: [{ category: 'harassment', finding: 'substantiated' }]
|
||||
});
|
||||
expect(moderationCaseDetail('first', id).assessmentHistory).toHaveLength(2);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user