stricter checks
CI / verify (pull_request) Successful in 12s

This commit is contained in:
2026-10-10 15:16:53 +02:00
parent ced43fbb11
commit 513d51f702
30 changed files with 984 additions and 470 deletions
+10 -5
View File
@@ -97,7 +97,10 @@ test("reads credentials file and sends OAuth usage request", async () => {
changed++;
},
async (input, init) => {
calls.push({ url: String(input), headers: new Headers(init?.headers) });
calls.push({
url: input instanceof Request ? input.url : String(input),
headers: new Headers(init?.headers),
});
return Response.json(payload);
},
60_000,
@@ -105,10 +108,12 @@ test("reads credentials file and sends OAuth usage request", async () => {
);
await tracker.init();
expect(calls).toHaveLength(1);
expect(calls[0]!.url).toBe("https://api.anthropic.com/api/oauth/usage");
expect(calls[0]!.headers.get("authorization")).toBe("Bearer token-123");
expect(calls[0]!.headers.get("anthropic-beta")).toBe("oauth-2025-04-20");
expect(calls[0]!.headers.get("accept")).toBe("application/json");
const [call] = calls;
if (!call) throw new Error("Missing usage request");
expect(call.url).toBe("https://api.anthropic.com/api/oauth/usage");
expect(call.headers.get("authorization")).toBe("Bearer token-123");
expect(call.headers.get("anthropic-beta")).toBe("oauth-2025-04-20");
expect(call.headers.get("accept")).toBe("application/json");
expect(tracker.status()?.plan).toBe("max");
expect(tracker.status()?.windows[0]?.remaining).toBe(87.5);
expect(changed).toBe(1);