Handle combined signup verification/profile page

This commit is contained in:
EmptyDust
2026-05-02 11:19:22 +08:00
parent 99313843c1
commit 2bfa277aa1
8 changed files with 479 additions and 7 deletions
+60
View File
@@ -1219,6 +1219,66 @@ test('verification flow uses resilient signup-page transport when submitting ver
assert.ok(resilientCalls[0].options.timeoutMs >= 30000);
});
test('verification flow forwards optional signup profile payload when submitting signup verification code', async () => {
const resilientCalls = [];
const helpers = api.createVerificationFlowHelpers({
addLog: async () => {},
chrome: {
tabs: {
update: async () => {},
},
},
CLOUDFLARE_TEMP_EMAIL_PROVIDER: 'cloudflare-temp-email',
completeStepFromBackground: async () => {},
confirmCustomVerificationStepBypassRequest: async () => ({ confirmed: true }),
getHotmailVerificationPollConfig: () => ({}),
getHotmailVerificationRequestTimestamp: () => 0,
getState: async () => ({}),
getTabId: async () => 1,
HOTMAIL_PROVIDER: 'hotmail-api',
isStopError: () => false,
LUCKMAIL_PROVIDER: 'luckmail-api',
MAIL_2925_VERIFICATION_INTERVAL_MS: 15000,
MAIL_2925_VERIFICATION_MAX_ATTEMPTS: 15,
pollCloudflareTempEmailVerificationCode: async () => ({}),
pollHotmailVerificationCode: async () => ({}),
pollLuckmailVerificationCode: async () => ({}),
sendToContentScript: async () => {
throw new Error('should not use non-resilient channel');
},
sendToContentScriptResilient: async (_source, message) => {
resilientCalls.push(message);
return { success: true, skipProfileStep: true };
},
sendToMailContentScriptResilient: async () => ({}),
setState: async () => {},
setStepStatus: async () => {},
sleepWithStop: async () => {},
throwIfStopped: () => {},
VERIFICATION_POLL_MAX_ROUNDS: 5,
});
const result = await helpers.submitVerificationCode(4, '654321', {
signupProfile: {
firstName: 'Ada',
lastName: 'Lovelace',
year: 2003,
month: 6,
day: 19,
},
});
assert.deepStrictEqual(result, { success: true, skipProfileStep: true });
assert.deepStrictEqual(resilientCalls[0].payload.signupProfile, {
firstName: 'Ada',
lastName: 'Lovelace',
year: 2003,
month: 6,
day: 19,
});
});
test('verification flow treats retryable submit transport failure as success when step 4 already redirected to logged-in home', async () => {
const logs = [];