数字我 Digital Me:全量入库(大文件走 Git LFS)
nginx serve /uploads direct (audio speed) / patch-nginx (push) Failing after 1m34s

This commit is contained in:
2026-10-10 16:24:43 +08:00
commit 0593ff7e62
1893 changed files with 361723 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import { listToubiao, computeDist, QUESTIONS } from '../src/toubiao.js';
test('题库:每题两选项 + 双证揭晓带cite', () => {
const list = listToubiao();
assert.ok(list.length >= 4);
for (const q of list) {
assert.ok(q.qid && q.title && q.situ && q.options?.length === 2);
}
for (const q of Object.values(QUESTIONS)) {
assert.ok(q.real && /《.+》/.test(q.cite), `${q.qid} 揭晓须有正史 cite`);
}
});
test('computeDist:占比正确、零票不除零', () => {
const opts = [{ id: 'a' }, { id: 'b' }];
const r = computeDist({ a: 87, b: 13 }, opts);
assert.equal(r.total, 100);
assert.equal(r.dist.a.pct, 87);
assert.equal(r.dist.b.pct, 13);
const z = computeDist({}, opts);
assert.equal(z.total, 0);
assert.equal(z.dist.a.pct, 0); // 不除零
});