进一步拆分 useAccountPayment:提取 useWalletBind、usePaymentFlow、useBilling 三个子 hook

This commit is contained in:
2569718930@qq.com
2026-05-25 03:05:39 +08:00
parent 59dc74b5e1
commit 53f17ac4f2
2 changed files with 16 additions and 2 deletions
@@ -53,17 +53,28 @@ export function runTests() {
const hookSource = fs.existsSync(hookPath)
? fs.readFileSync(hookPath, "utf8")
: "";
const paymentFlowPath = path.join(
projectRoot,
"components",
"account",
"usePaymentFlow.ts",
);
const paymentFlowSource = fs.existsSync(paymentFlowPath)
? fs.readFileSync(paymentFlowPath, "utf8")
: "";
// The receiver validation now lives in the extracted hook file (called
// from createManualPaymentIntent and createIntentAndPay).
assert(
accountCenterSource.includes("assertExpectedPaymentReceiver") ||
hookSource.includes("assertExpectedPaymentReceiver"),
hookSource.includes("assertExpectedPaymentReceiver") ||
paymentFlowSource.includes("assertExpectedPaymentReceiver"),
"AccountCenter must validate backend-returned manual payment receiver before displaying it",
);
assert(
accountCenterSource.includes("EXPECTED_PAYMENT_RECEIVER_ADDRESS") ||
hookSource.includes("EXPECTED_PAYMENT_RECEIVER_ADDRESS"),
hookSource.includes("EXPECTED_PAYMENT_RECEIVER_ADDRESS") ||
paymentFlowSource.includes("EXPECTED_PAYMENT_RECEIVER_ADDRESS"),
"AccountCenter must show the pinned payment receiver address in its payment guard",
);
@@ -39,6 +39,9 @@ export function runTests() {
"wallet.ts",
"payment-utils.ts",
"usePaymentState.ts",
"useWalletBind.ts",
"usePaymentFlow.ts",
"useBilling.ts",
]
.map((file) => fs.readFileSync(path.join(accountDir, file), "utf8"))
.join("\n");