refactor flows into canonical runtime architecture
This commit is contained in:
@@ -10,10 +10,10 @@ function assertOrdered(list, before, after) {
|
||||
|
||||
test('manifest loads operation delay after utils only for covered auth/provider bundles', () => {
|
||||
const manifest = JSON.parse(fs.readFileSync('manifest.json', 'utf8'));
|
||||
const authBundle = manifest.content_scripts.find((entry) => entry.js.includes('content/signup-page.js')).js;
|
||||
const authBundle = manifest.content_scripts.find((entry) => entry.js.includes('flows/openai/content/openai-auth.js')).js;
|
||||
assertOrdered(authBundle, 'content/utils.js', 'content/operation-delay.js');
|
||||
assertOrdered(authBundle, 'content/operation-delay.js', 'content/auth-page-recovery.js');
|
||||
assertOrdered(authBundle, 'content/operation-delay.js', 'content/signup-page.js');
|
||||
assertOrdered(authBundle, 'content/operation-delay.js', 'flows/openai/content/auth-page-recovery.js');
|
||||
assertOrdered(authBundle, 'content/operation-delay.js', 'flows/openai/content/openai-auth.js');
|
||||
|
||||
const duckBundle = manifest.content_scripts.find((entry) => entry.js.includes('content/duck-mail.js')).js;
|
||||
assertOrdered(duckBundle, 'content/utils.js', 'content/operation-delay.js');
|
||||
@@ -27,11 +27,11 @@ test('manifest loads operation delay after utils only for covered auth/provider
|
||||
|
||||
test('dynamic covered injections load operation delay after utils', () => {
|
||||
const expectations = [
|
||||
['background.js', 'SIGNUP_PAGE_INJECT_FILES'],
|
||||
['background/steps/create-plus-checkout.js', 'PLUS_CHECKOUT_INJECT_FILES'],
|
||||
['background/steps/fill-plus-checkout.js', 'PLUS_CHECKOUT_INJECT_FILES'],
|
||||
['background/steps/paypal-approve.js', 'PAYPAL_INJECT_FILES'],
|
||||
['background/steps/gopay-approve.js', 'GOPAY_INJECT_FILES'],
|
||||
['background.js', 'OPENAI_AUTH_INJECT_FILES'],
|
||||
['flows/openai/background/steps/create-plus-checkout.js', 'PLUS_CHECKOUT_INJECT_FILES'],
|
||||
['flows/openai/background/steps/fill-plus-checkout.js', 'PLUS_CHECKOUT_INJECT_FILES'],
|
||||
['flows/openai/background/steps/paypal-approve.js', 'PAYPAL_INJECT_FILES'],
|
||||
['flows/openai/background/steps/gopay-approve.js', 'GOPAY_INJECT_FILES'],
|
||||
['background/mail-2925-session.js', 'MAIL2925_INJECT'],
|
||||
];
|
||||
for (const [file, constantName] of expectations) {
|
||||
@@ -40,8 +40,8 @@ test('dynamic covered injections load operation delay after utils', () => {
|
||||
assert.ok(match, `missing ${constantName} in ${file}`);
|
||||
const block = match[1];
|
||||
assert.match(block, /'content\/utils\.js'[\s\S]*'content\/operation-delay\.js'/, `${file} must inject operation delay after utils`);
|
||||
if (constantName === 'SIGNUP_PAGE_INJECT_FILES') {
|
||||
assert.match(block, /'content\/operation-delay\.js'[\s\S]*'content\/auth-page-recovery\.js'/, 'auth recovery must load after operation delay');
|
||||
if (constantName === 'OPENAI_AUTH_INJECT_FILES') {
|
||||
assert.match(block, /'content\/operation-delay\.js'[\s\S]*'flows\/openai\/content\/auth-page-recovery\.js'/, 'auth recovery must load after operation delay');
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -56,7 +56,7 @@ test('2925 provider reuse path also injects operation delay', () => {
|
||||
});
|
||||
|
||||
test('excluded platform verification paths do not load operation delay', () => {
|
||||
for (const file of ['background/steps/platform-verify.js', 'background/panel-bridge.js']) {
|
||||
for (const file of ['flows/openai/background/steps/platform-verify.js', 'background/panel-bridge.js']) {
|
||||
const source = fs.readFileSync(file, 'utf8');
|
||||
assert.doesNotMatch(source, /content\/operation-delay\.js/);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user