feat: 增强自动运行记录状态处理,确保真实失败步骤不被误解析为指导文本
This commit is contained in:
@@ -15,3 +15,31 @@ test('auto-run controller module exposes a factory', () => {
|
||||
|
||||
assert.equal(typeof api?.createAutoRunController, 'function');
|
||||
});
|
||||
|
||||
test('auto-run account record status preserves the real failed step instead of parsing guidance text', () => {
|
||||
const source = fs.readFileSync('background/auto-run-controller.js', 'utf8');
|
||||
const globalScope = {};
|
||||
const api = new Function('self', `${source}; return self.MultiPageBackgroundAutoRunController;`)(globalScope);
|
||||
const controller = api.createAutoRunController({});
|
||||
|
||||
const state = {
|
||||
currentStep: 11,
|
||||
stepStatuses: {
|
||||
2: 'completed',
|
||||
10: 'completed',
|
||||
11: 'failed',
|
||||
},
|
||||
};
|
||||
const error = new Error('缺少登录账号:请先完成步骤 2,或在侧栏填写账号后再执行当前步骤。');
|
||||
|
||||
assert.equal(
|
||||
controller.resolveAutoRunAccountRecordStatus('failed', state, error),
|
||||
'step11_failed'
|
||||
);
|
||||
|
||||
error.failedStep = 13;
|
||||
assert.equal(
|
||||
controller.resolveAutoRunAccountRecordStatus('failed', state, error),
|
||||
'step13_failed'
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user