feat(moderation): enhance media evidence handling and deferral analysis rejection

This commit is contained in:
MythEclipse
2026-05-29 17:32:04 +07:00
parent 0e9890db79
commit 2b1c436b3e
4 changed files with 278 additions and 61 deletions
@@ -77,6 +77,25 @@ describe("parseModerationResponse", () => {
]);
});
it("rejects deferral analysis text", () => {
expect(() =>
parseModerationResponse(
JSON.stringify({
results: [
{
message_id: "m1",
status: "warn",
flags: [],
score: 0.4,
analysis: "Kurang konteks, perlu dicek admin.",
},
],
}),
["m1"],
),
).toThrow(/deferral/i);
});
it("handles missing target ids gracefully", () => {
const result = parseModerationResponse(JSON.stringify({ results: [] }), [
"m1",