MC/website/tests/moderation-sync-integrity.test.mjs
2026-11-27 23:43:05 +00:00

4 lines
512 B
JavaScript

import test from 'node:test';
import assert from 'node:assert/strict';
import {createModeration} from '../control-panel/moderation.mjs';
test('moderation sync rejects an invalid empty ban feed without mutating history',async()=>{let writes=0;const db={prepare(){writes++;throw Error('must not write')}};const moderation=createModeration(db,{SERVER_CONTROL_TOKEN:'x'},{fetcher:async()=>Response.json({bans:[],sources:[]})});await assert.rejects(moderation.sync(),/Invalid ban sources/);assert.equal(writes,0);});