feat: publish verified five-bank question dataset

This commit is contained in:
suanyuit-cyber
2026-10-29 23:09:32 +08:00
parent c3edf3975e
commit 26e0a920b6
26 changed files with 109610 additions and 1560 deletions
+27
View File
@@ -133,6 +133,33 @@ test('历史误报和图片补全:原始备份、设置导出、旧标签写
assert.equal(rawBackup.migrations.length, 2, '内存和GM中的两个原始元数据版本均有明确退休证据');
await context.close(); context = null;
const oldMath = { ...oldImage, questionId: 'old-math', stem: '传热速率=系数×推动力,误差±2。' };
const newMath = core.normalizeRecord({ ...snapshot[0], questionId: 'new-math', stem: '传热速率=系数×推动力,误差±2。' });
const existingModern = core.normalizeRecord({ ...newMath, questionId: 'existing-modern-math', questionIdAliases: ['older-modern-math'],
source: { ...newSource, batchId: 'earlier-modern-batch' } });
context = await createContext([oldMath, existingModern, oldOther]);
const mathPage = await context.newPage();
await mathPage.goto('https://www.shhuayi-elearning.cn/repair-fixture');
await mathPage.locator('#huayi-qb-root').waitFor({ state: 'attached' });
await mathPage.evaluate(({ snapshot, bankId }) => window.__qaReceive(snapshot, { fullSnapshot: true, pageQuestionCount: 2, currentBankId: bankId }),
{ snapshot: [newMath, snapshot[1]], bankId: bank.bankId });
await waitFor(async () => (await storageRecords(mathPage)).length === 2, '实体补全应修复已经同时保存新旧两种文字的题库');
const mathRecords = await storageRecords(mathPage);
const canonicalMath = mathRecords.find(record => record.stem === newMath.stem);
assert.equal(canonicalMath.questionId, existingModern.questionId, '合并可保留已有别名记录的canonical ID');
assert.ok(canonicalMath.questionIdAliases.includes(newMath.questionId));
assert.ok(canonicalMath.questionIdAliases.includes(oldMath.questionId));
const mathBackup = await mathPage.evaluate(key => GM_getValue(key, null), IMAGE_UPGRADE_BACKUP_KEY);
assert.ok(mathBackup.records.some(record => record.questionId === oldMath.questionId && record.stem === oldMath.stem));
assert.ok(mathBackup.migrations.every(item => item.kind === 'math-entity'));
await mathPage.evaluate(({ stale, key }) => { GM_setValue(key, stale); window.__qaRemoteChange(key, [], stale, true); },
{ stale: [...mathRecords, oldMath], key: RECORDS_KEY });
await waitFor(async () => (await storageRecords(mathPage)).length === 2, '别名合并改变replacement key后,旧实体版本仍不得复活');
await mathPage.reload();
await mathPage.locator('#huayi-qb-root').waitFor({ state: 'attached' });
assert.equal((await storageRecords(mathPage)).length, 2);
await context.close(); context = null;
context = await createContext([legacy], true);
const blocked = await context.newPage();
await blocked.goto('https://www.shhuayi-elearning.cn/repair-fixture');