feat: lay groundwork for multi-flow registries

This commit is contained in:
QLHazyCoder
2026-05-13 04:46:56 +08:00
parent 04f89620be
commit a85ed0ce89
28 changed files with 2775 additions and 92 deletions
+37
View File
@@ -9,6 +9,7 @@ const api = new Function('self', `${source}; return self.MultiPageBackgroundVeri
function createVerificationFlowTestHelpers(overrides = {}) {
return api.createVerificationFlowHelpers({
addLog: async () => {},
buildVerificationPollPayload: null,
chrome: {
tabs: {
update: async () => {},
@@ -43,6 +44,42 @@ function createVerificationFlowTestHelpers(overrides = {}) {
});
}
test('verification flow prefers injected verification poll payload builder when provided', () => {
const helpers = createVerificationFlowTestHelpers({
buildVerificationPollPayload: (step, state, overrides = {}) => ({
flowId: state.activeFlowId || 'openai',
ruleId: 'custom-rule',
step,
senderFilters: ['custom-sender'],
subjectFilters: ['custom-subject'],
targetEmail: state.email,
maxAttempts: 9,
intervalMs: 4321,
...overrides,
}),
});
assert.deepStrictEqual(
helpers.getVerificationPollPayload(4, {
activeFlowId: 'openai',
email: 'user@example.com',
}, {
excludeCodes: ['111111'],
}),
{
flowId: 'openai',
ruleId: 'custom-rule',
step: 4,
senderFilters: ['custom-sender'],
subjectFilters: ['custom-subject'],
targetEmail: 'user@example.com',
maxAttempts: 9,
intervalMs: 4321,
excludeCodes: ['111111'],
}
);
});
test('verification flow keeps 2925 polling cadence in the default payload', () => {
const helpers = api.createVerificationFlowHelpers({
addLog: async () => {},