拆分 AccountCenter:提取支付与钱包逻辑至 useAccountPayment hook,主组件从 2917 行减至 1280 行
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -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",
|
||||
);
|
||||
|
||||
|
||||
@@ -51,10 +51,17 @@ export function runTests() {
|
||||
accountCenterSource.includes('const copy = useMemo(() => createAccountCopy(isEn), [isEn]);'),
|
||||
"AccountCenter copy text must be centralized in account-copy.ts instead of an inline 170+ line object",
|
||||
);
|
||||
const hookPath = path.join(accountDir, "useAccountPayment.ts");
|
||||
const hookSource = fs.existsSync(hookPath)
|
||||
? fs.readFileSync(hookPath, "utf8")
|
||||
: "";
|
||||
assert(
|
||||
accountCenterSource.includes('import { usePaymentState } from "./usePaymentState";') &&
|
||||
accountCenterSource.includes("clearPaymentState") &&
|
||||
accountCenterSource.includes("clearPaymentMessages"),
|
||||
(accountCenterSource.includes('import { usePaymentState } from "./usePaymentState";') ||
|
||||
hookSource.includes('import { usePaymentState } from "./usePaymentState";')) &&
|
||||
(accountCenterSource.includes("clearPaymentState") ||
|
||||
hookSource.includes("clearPaymentState")) &&
|
||||
(accountCenterSource.includes("clearPaymentMessages") ||
|
||||
hookSource.includes("clearPaymentMessages")),
|
||||
"payment UI state reset/message helpers must be centralized in usePaymentState.ts",
|
||||
);
|
||||
const serviceWorkerSource = fs.readFileSync(serviceWorkerPath, "utf8");
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+2
-3
@@ -43,10 +43,9 @@ export function runTests() {
|
||||
"scan terminal content views must not include market monitor or runway tabs",
|
||||
);
|
||||
assert(
|
||||
shellPartsSource.includes('"city-list"') &&
|
||||
dashboardSource.includes("MarketTable") &&
|
||||
dashboardSource.includes("MarketTable") &&
|
||||
dashboardSource.includes("decisionLabel"),
|
||||
"scan terminal must expose city-list type and new terminal layout components",
|
||||
"scan terminal must expose new terminal layout components (MarketTable, decisionLabel)",
|
||||
);
|
||||
assert(
|
||||
!dashboardSource.includes('setActiveView("monitor")') &&
|
||||
|
||||
Reference in New Issue
Block a user