进一步拆分 useAccountPayment:提取 useWalletBind、usePaymentFlow、useBilling 三个子 hook
This commit is contained in:
@@ -53,17 +53,28 @@ export function runTests() {
|
|||||||
const hookSource = fs.existsSync(hookPath)
|
const hookSource = fs.existsSync(hookPath)
|
||||||
? fs.readFileSync(hookPath, "utf8")
|
? 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
|
// The receiver validation now lives in the extracted hook file (called
|
||||||
// from createManualPaymentIntent and createIntentAndPay).
|
// from createManualPaymentIntent and createIntentAndPay).
|
||||||
assert(
|
assert(
|
||||||
accountCenterSource.includes("assertExpectedPaymentReceiver") ||
|
accountCenterSource.includes("assertExpectedPaymentReceiver") ||
|
||||||
hookSource.includes("assertExpectedPaymentReceiver"),
|
hookSource.includes("assertExpectedPaymentReceiver") ||
|
||||||
|
paymentFlowSource.includes("assertExpectedPaymentReceiver"),
|
||||||
"AccountCenter must validate backend-returned manual payment receiver before displaying it",
|
"AccountCenter must validate backend-returned manual payment receiver before displaying it",
|
||||||
);
|
);
|
||||||
assert(
|
assert(
|
||||||
accountCenterSource.includes("EXPECTED_PAYMENT_RECEIVER_ADDRESS") ||
|
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",
|
"AccountCenter must show the pinned payment receiver address in its payment guard",
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,9 @@ export function runTests() {
|
|||||||
"wallet.ts",
|
"wallet.ts",
|
||||||
"payment-utils.ts",
|
"payment-utils.ts",
|
||||||
"usePaymentState.ts",
|
"usePaymentState.ts",
|
||||||
|
"useWalletBind.ts",
|
||||||
|
"usePaymentFlow.ts",
|
||||||
|
"useBilling.ts",
|
||||||
]
|
]
|
||||||
.map((file) => fs.readFileSync(path.join(accountDir, file), "utf8"))
|
.map((file) => fs.readFileSync(path.join(accountDir, file), "utf8"))
|
||||||
.join("\n");
|
.join("\n");
|
||||||
|
|||||||
Reference in New Issue
Block a user