Refactor workflow auto-run to node graph

This commit is contained in:
QLHazyCoder
2026-05-15 17:41:35 +08:00
parent f6f804f1a2
commit 81fc40706a
76 changed files with 4028 additions and 1453 deletions
+9 -9
View File
@@ -16,30 +16,30 @@ 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', () => {
test('auto-run account record status preserves the real failed node 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',
currentNodeId: 'fetch-login-code',
nodeStatuses: {
'submit-signup-email': 'completed',
'oauth-login': 'completed',
'fetch-login-code': 'failed',
},
};
const error = new Error('缺少登录账号:请先完成步骤 2,或在侧栏填写账号后再执行当前步骤。');
assert.equal(
controller.resolveAutoRunAccountRecordStatus('failed', state, error),
'step11_failed'
'node:fetch-login-code:failed'
);
error.failedStep = 13;
error.failedNodeId = 'platform-verify';
assert.equal(
controller.resolveAutoRunAccountRecordStatus('failed', state, error),
'step13_failed'
'node:platform-verify:failed'
);
});