| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- const test = require('node:test');
- const assert = require('node:assert/strict');
- const fs = require('node:fs');
- const source = fs.readFileSync('background/steps/fetch-signup-code.js', 'utf8');
- const globalScope = {};
- const api = new Function('self', `${source}; return self.MultiPageBackgroundStep4;`)(globalScope);
- test('step 4 does not request a fresh code first for A4Sky mailbox', async () => {
- let capturedOptions = null;
- const executor = api.createStep4Executor({
- A4SKY_PROVIDER: 'a4sky',
- addLog: async () => {},
- chrome: { tabs: { update: async () => {} } },
- completeStepFromBackground: async () => {},
- confirmCustomVerificationStepBypass: async () => {},
- getMailConfig: () => ({
- provider: 'a4sky',
- label: 'A4Sky 邮箱(mail.phplife.net)',
- source: 'mail-phplife',
- url: 'https://mail.phplife.net/?_task=mail&_mbox=INBOX',
- navigateOnReuse: false,
- }),
- getTabId: async (sourceName) => (sourceName === 'signup-page' ? 1 : 2),
- HOTMAIL_PROVIDER: 'hotmail-api',
- isTabAlive: async () => true,
- LUCKMAIL_PROVIDER: 'luckmail-api',
- CLOUDFLARE_TEMP_EMAIL_PROVIDER: 'cloudflare-temp-email',
- resolveVerificationStep: async (_step, _state, _mail, options) => {
- capturedOptions = options;
- },
- reuseOrCreateTab: async () => {},
- sendToContentScriptResilient: async () => ({ ready: true }),
- shouldUseCustomRegistrationEmail: () => false,
- STANDARD_MAIL_VERIFICATION_RESEND_INTERVAL_MS: 25000,
- throwIfStopped: () => {},
- });
- await executor.executeStep4({
- email: 'n20260419100609@a4sky.com',
- password: 'Secret123!',
- });
- assert.equal(capturedOptions.requestFreshCodeFirst, false);
- assert.equal(capturedOptions.resendIntervalMs, 25000);
- });
|