拆分 AccountCenter:提取支付与钱包逻辑至 useAccountPayment hook,主组件从 2917 行减至 1280 行
This commit is contained in:
@@ -44,12 +44,26 @@ export function runTests() {
|
||||
);
|
||||
|
||||
const accountCenterSource = fs.readFileSync(accountCenterPath, "utf8");
|
||||
const hookPath = path.join(
|
||||
projectRoot,
|
||||
"components",
|
||||
"account",
|
||||
"useAccountPayment.ts",
|
||||
);
|
||||
const hookSource = fs.existsSync(hookPath)
|
||||
? fs.readFileSync(hookPath, "utf8")
|
||||
: "";
|
||||
|
||||
// The receiver validation now lives in the extracted hook file (called
|
||||
// from createManualPaymentIntent and createIntentAndPay).
|
||||
assert(
|
||||
accountCenterSource.includes("assertExpectedPaymentReceiver"),
|
||||
accountCenterSource.includes("assertExpectedPaymentReceiver") ||
|
||||
hookSource.includes("assertExpectedPaymentReceiver"),
|
||||
"AccountCenter must validate backend-returned manual payment receiver before displaying it",
|
||||
);
|
||||
assert(
|
||||
accountCenterSource.includes("EXPECTED_PAYMENT_RECEIVER_ADDRESS"),
|
||||
accountCenterSource.includes("EXPECTED_PAYMENT_RECEIVER_ADDRESS") ||
|
||||
hookSource.includes("EXPECTED_PAYMENT_RECEIVER_ADDRESS"),
|
||||
"AccountCenter must show the pinned payment receiver address in its payment guard",
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user