feat: 添加 Plus 模式和贡献模式支持,增强步骤执行延迟和提示逻辑
This commit is contained in:
@@ -45,11 +45,15 @@ const bundle = [
|
||||
'const AUTO_STEP_DELAY_MIN_ALLOWED_SECONDS = 0;',
|
||||
'const AUTO_STEP_DELAY_MAX_ALLOWED_SECONDS = 600;',
|
||||
'const PERSISTED_SETTING_DEFAULTS = { autoStepDelaySeconds: null };',
|
||||
"const AUTO_RUN_PRE_EXECUTION_DELAYS_BY_STEP_KEY = new Map([['plus-checkout-create', 20000]]);",
|
||||
'function getStepDefinitionForState(step, state = {}) { return state.definitions?.[step] || null; }',
|
||||
extractFunction('normalizeAutoStepDelaySeconds'),
|
||||
extractFunction('resolveLegacyAutoStepDelaySeconds'),
|
||||
extractFunction('getStepExecutionKeyForState'),
|
||||
extractFunction('getAutoRunPreExecutionDelayMs'),
|
||||
].join('\n');
|
||||
|
||||
const api = new Function(`${bundle}; return { normalizeAutoStepDelaySeconds, resolveLegacyAutoStepDelaySeconds };`)();
|
||||
const api = new Function(`${bundle}; return { normalizeAutoStepDelaySeconds, resolveLegacyAutoStepDelaySeconds, getAutoRunPreExecutionDelayMs };`)();
|
||||
|
||||
assert.strictEqual(
|
||||
api.normalizeAutoStepDelaySeconds(''),
|
||||
@@ -123,4 +127,24 @@ assert.strictEqual(
|
||||
'empty legacy settings should migrate to no delay'
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
api.getAutoRunPreExecutionDelayMs(6, {
|
||||
definitions: {
|
||||
6: { key: 'plus-checkout-create' },
|
||||
},
|
||||
}),
|
||||
20000,
|
||||
'Plus checkout create should wait before step execution'
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
api.getAutoRunPreExecutionDelayMs(6, {
|
||||
definitions: {
|
||||
6: { key: 'clear-login-cookies' },
|
||||
},
|
||||
}),
|
||||
0,
|
||||
'normal step 6 should not inherit the Plus checkout pre-wait'
|
||||
);
|
||||
|
||||
console.log('auto step delay tests passed');
|
||||
|
||||
Reference in New Issue
Block a user