test(membership): update balance notification contract
Independent Staging Quality Gate / validate (push) Failing after 16m28s
Independent Staging Quality Gate / publish (push) Skipped

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
jesse-ux
2026-09-24 22:18:25 +08:00
co-authored by Claude Code
parent 651c75e7ad
commit 7a00145698
@@ -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", () => {