feat: show current-cycle token totals

This commit is contained in:
2026-08-14 11:07:46 +08:00
parent 1ec9001387
commit bf37999833
12 changed files with 254 additions and 19 deletions
+23
View File
@@ -24,6 +24,29 @@ describe("API decoders", () => {
expect(value.account.email).toBeNull();
});
it("解码当前重置周期 Token 合计", () => {
const value = decodeDashboard({
accountId: 1,
displayName: "个人账号",
account: { email: "user@example.com", planType: "plus", connected: true },
limits: [],
currentCycle: {
limitId: "codex",
windowType: "secondary",
windowDurationMinutes: 10080,
startedAt: 1_900_000_000,
resetsAt: 1_900_604_800,
totalTokens: 123_456,
},
summary: {},
usage: [],
fetchedAt: 1_900_000_000,
stale: false,
});
expect(value.currentCycle?.windowType).toBe("secondary");
expect(value.currentCycle?.totalTokens).toBe(123_456);
});
it("拒绝未知主题", () => {
expect(() =>
decodeGeneral({