test(membership): update balance notification contract
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -20,7 +20,10 @@ test("packages load on mount without a redundant account request", () => {
|
||||
assert.doesNotMatch(hookSource, /fetchAccountData/);
|
||||
assert.doesNotMatch(hookSource, /fetch\("\/api\/account"/);
|
||||
assert.match(hookSource, /notifyBalanceChanged\(result\.credits\)/);
|
||||
assert.match(hookSource, /notifyBalanceChanged\(payload\.credits\)/);
|
||||
// 原值: 套餐支付成功契约精确断言 `notifyBalanceChanged(payload.credits)`。
|
||||
// 新值: 支付成功无条件调用 `notifyBalanceChanged(typeof payload.credits === "number" ? payload.credits : 0)`。
|
||||
// 原因: 订阅响应可能缺少 credits,仍需广播余额刷新事件;未知载荷使用 0,服务端刷新保持权威。
|
||||
assert.match(hookSource, /notifyBalanceChanged\(typeof payload\.credits === "number" \? payload\.credits : 0\)/);
|
||||
});
|
||||
|
||||
test("a failing packages request cannot hide the account summary", () => {
|
||||
|
||||
Reference in New Issue
Block a user