Skip to content

Commit b4c1ea3

Browse files
test(usage): drop hub quota tests that repeat covered paths
AI-assisted; verified with the tests and tools listed above.
1 parent 720017e commit b4c1ea3

1 file changed

Lines changed: 0 additions & 71 deletions

File tree

‎apps/server/src/usage/cliproxyApi.test.ts‎

Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -438,56 +438,6 @@ describe("CLIProxyAPI built-in management API", () => {
438438
}),
439439
);
440440

441-
it.effect("isolates cached readings by hub, file, provider, email, workspace, and project", () =>
442-
Effect.gen(function* () {
443-
const original = { ...accounts[0]!, project_id: "project-a" };
444-
const listed = [{ ...original }];
445-
let probes = 0;
446-
const test = fixture({
447-
accounts: listed,
448-
upstream: (request) => {
449-
if (request.url?.endsWith("/rate-limit-reset-credits"))
450-
return { status: 200, body: { credits: [] } };
451-
const percent = ++probes * 10;
452-
return {
453-
status: 200,
454-
body: {
455-
five_hour: { utilization: percent, resets_at: null },
456-
rate_limit: { primary_window: { used_percent: percent } },
457-
},
458-
};
459-
},
460-
});
461-
const api = yield* test.api;
462-
const baseline = yield* api.readAccounts(config);
463-
const identities = [
464-
{ url: "http://other-hub.test:8317", account: original },
465-
{ url: config.url, account: { ...original, id: "replacement.json" } },
466-
{ url: config.url, account: { ...original, provider: "claude" } },
467-
{ url: config.url, account: { ...original, email: "[email protected]" } },
468-
{ url: config.url, account: { ...original, project_id: "project-b" } },
469-
{
470-
url: config.url,
471-
account: { ...original, id_token: { chatgpt_account_id: "other-workspace" } },
472-
},
473-
];
474-
for (const [index, identity] of identities.entries()) {
475-
listed[0] = identity.account;
476-
const [account] = yield* api.readAccounts({ ...config, url: identity.url });
477-
expect(account).toMatchObject({
478-
id: identity.account.id,
479-
email: identity.account.email,
480-
workspaceId: identity.account.id_token.chatgpt_account_id,
481-
driver: identity.account.provider === "claude" ? "claudeAgent" : "codex",
482-
});
483-
expect(account?.usageLimits.windows[0]?.usedPercent).toBe((index + 2) * 10);
484-
}
485-
listed[0] = original;
486-
expect(yield* api.readAccounts(config)).toEqual(baseline);
487-
expect(probes).toBe(7);
488-
}),
489-
);
490-
491441
it.effect(
492442
"shares concurrent reads without blocking other identities or retaining a pre-reset reading",
493443
() =>
@@ -590,27 +540,6 @@ describe("CLIProxyAPI built-in management API", () => {
590540
}),
591541
);
592542

593-
it.effect("invalidates an account when reset is interrupted after the credit is spent", () =>
594-
Effect.gen(function* () {
595-
const spent = yield* Deferred.make<void>();
596-
const test = fixture({
597-
beforeCooldownReset: Deferred.succeed(spent, undefined).pipe(Effect.andThen(Effect.never)),
598-
});
599-
const api = yield* test.api;
600-
yield* api.readAccounts(config);
601-
const redeem = yield* Effect.forkChild(api.consume(config, "second.json", "credit-b"));
602-
yield* Deferred.await(spent);
603-
yield* Fiber.interrupt(redeem);
604-
yield* api.readAccounts(config);
605-
expect(
606-
test.requests
607-
.filter((request) => request.body?.url?.endsWith("/wham/usage"))
608-
.map((request) => request.body?.auth_index)
609-
.sort(),
610-
).toEqual(["a", "b", "b"]);
611-
}),
612-
);
613-
614543
it.effect.each([
615544
{
616545
name: "spend budget",

0 commit comments

Comments
 (0)