34 lines
1.8 KiB
JavaScript
34 lines
1.8 KiB
JavaScript
const test = require('node:test');
|
|
const assert = require('node:assert/strict');
|
|
const fs = require('node:fs');
|
|
|
|
test('background imports node registry and shared workflow definitions', () => {
|
|
const source = fs.readFileSync('background.js', 'utf8');
|
|
assert.match(source, /background\/steps\/registry\.js/);
|
|
assert.match(source, /data\/step-definitions\.js/);
|
|
assert.match(source, /background\/workflow-engine\.js/);
|
|
assert.match(source, /MultiPageStepDefinitions\?\.getNodes/);
|
|
assert.match(source, /getStepRegistryForState\(state\)/);
|
|
assert.match(source, /buildNodeRegistry\(definitions/);
|
|
assert.match(source, /PLUS_PAYPAL_STEP_DEFINITIONS/);
|
|
assert.match(source, /PLUS_GOPAY_STEP_DEFINITIONS/);
|
|
assert.match(source, /plusPayPalStepRegistry/);
|
|
assert.match(source, /plusGoPayStepRegistry/);
|
|
assert.match(source, /normalizePlusPaymentMethod\(state\?\.plusPaymentMethod\) === PLUS_PAYMENT_METHOD_GOPAY/);
|
|
assert.match(source, /activeStepRegistry\.executeNode\(normalizedNodeId,\s*\{/);
|
|
assert.match(source, /background\/steps\/create-plus-checkout\.js/);
|
|
assert.match(source, /background\/steps\/fill-plus-checkout\.js/);
|
|
assert.match(source, /background\/steps\/gopay-manual-confirm\.js/);
|
|
assert.match(source, /'gopay-subscription-confirm': \(state\) => goPayManualConfirmExecutor\.executeGoPayManualConfirm\(state\)/);
|
|
assert.match(source, /background\/steps\/paypal-approve\.js/);
|
|
assert.match(source, /background\/steps\/gopay-approve\.js/);
|
|
assert.match(source, /background\/steps\/plus-return-confirm\.js/);
|
|
});
|
|
|
|
|
|
test('GoPay approve executor receives debugger click and manual OTP helpers', () => {
|
|
const source = fs.readFileSync('background.js', 'utf8');
|
|
assert.match(source, /createGoPayApproveExecutor\(\{[\s\S]*clickWithDebugger[\s\S]*requestGoPayOtpInput[\s\S]*\}\)/);
|
|
assert.match(source, /REQUEST_GOPAY_OTP_INPUT/);
|
|
});
|