feat: add local question bank reset with stale-tab isolation
This commit is contained in:
@@ -833,6 +833,26 @@ test('DOM standard feedback carries bound or known trusted answer evidence', asy
|
||||
page.adapter.stop();
|
||||
});
|
||||
|
||||
test('library reset clears cached standards and rejects pre-reset answer receipts after capture resumes', async () => {
|
||||
const page = bankPage(async () => new Response(JSON.stringify({ listQues: [single()] }), { headers: { 'content-type': 'application/json' } }));
|
||||
page.adapter.start();
|
||||
await page.win.fetch('/upm/start?praId=bank-a'); await flush(); await flush();
|
||||
page.state.feedback = [{ heading: '正确答案', answer: 'B' }];
|
||||
assert.equal(page.adapter.getCurrentQuestion().answerStatus, 'confirmed');
|
||||
const pending = new page.win.XMLHttpRequest();
|
||||
pending.open('PUT', '/upm/bank-a/users/u1/answer');
|
||||
pending.send(JSON.stringify({ answers: [{ quesId: 'q1', answer: ['a1'] }] }));
|
||||
page.adapter.clearCache();
|
||||
page.received.length = 0;
|
||||
assert.equal(page.adapter.getCurrentQuestion().answerStatus, 'missing', '重置后裸DOM反馈不能继承旧缓存标准');
|
||||
page.adapter.start();
|
||||
const count = page.received.length;
|
||||
pending.respond([{ answers: ['a2'] }]);
|
||||
assert.equal(page.received.length, count, '重置前未完成的回执不得在重新采集后写回');
|
||||
assert.equal(page.adapter.getCurrentQuestion().answerStatus, 'missing');
|
||||
page.adapter.stop();
|
||||
});
|
||||
|
||||
test('an older answer receipt cannot attach its answer to a newer same-id full snapshot', () => {
|
||||
const page = fakePage();
|
||||
page.adapter.start();
|
||||
|
||||
Reference in New Issue
Block a user