This commit is contained in:
+9
-9
@@ -329,11 +329,11 @@ test("reads old cached snapshots without session estimates and removes excluded
|
||||
]);
|
||||
expect(status?.windows[0]).not.toHaveProperty("sessionConsumed");
|
||||
expect(result.stored.get("chatgpt-quota")).not.toHaveProperty("sessions");
|
||||
expect(result.calls()).toBe(0);
|
||||
expect(result.calls()).toBe(1);
|
||||
await result.tracker.dispose();
|
||||
});
|
||||
|
||||
test("activates only for OAuth and refreshes quota at request start", async () => {
|
||||
test("activates only for OAuth and refreshes quota at initialization and request start", async () => {
|
||||
const key = fixture({ type: "key", key: "secret" }, [plus]);
|
||||
await key.tracker.init();
|
||||
await key.tracker.start("root");
|
||||
@@ -360,10 +360,11 @@ test("activates only for OAuth and refreshes quota at request start", async () =
|
||||
],
|
||||
);
|
||||
await oauth.tracker.init();
|
||||
await oauth.tracker.start("root");
|
||||
expect(oauth.calls()).toBe(1);
|
||||
expect(oauth.tracker.status()?.windows[0]?.remaining).toBe(87.5);
|
||||
await oauth.tracker.start("root");
|
||||
expect(oauth.calls()).toBe(2);
|
||||
expect(oauth.headers[0]?.get("chatgpt-account-id")).toBe("account-one");
|
||||
await oauth.tracker.refresh();
|
||||
const status = oauth.tracker.status();
|
||||
expect(status?.windows[0]?.remaining).toBe(82.5);
|
||||
expect(status?.windows[0]).not.toHaveProperty("sessionConsumed");
|
||||
@@ -482,10 +483,10 @@ test("request completion refreshes once across terminal and idle events", async
|
||||
await result.tracker.init();
|
||||
await result.tracker.start("root");
|
||||
await result.tracker.complete("root");
|
||||
expect(result.tracker.status()?.windows[0]?.remaining).toBe(89);
|
||||
expect(result.tracker.status()?.windows[0]?.remaining).toBe(70);
|
||||
await result.tracker.complete("root");
|
||||
expect(result.calls()).toBe(2);
|
||||
expect(result.tracker.status()?.windows[0]?.remaining).toBe(89);
|
||||
expect(result.calls()).toBe(3);
|
||||
expect(result.tracker.status()?.windows[0]?.remaining).toBe(70);
|
||||
await result.tracker.dispose();
|
||||
});
|
||||
|
||||
@@ -513,8 +514,7 @@ test("an auth switch detaches an in-flight old-account response and immediately
|
||||
},
|
||||
],
|
||||
);
|
||||
await result.tracker.init();
|
||||
const old = result.tracker.start("root");
|
||||
const old = result.tracker.init();
|
||||
while (result.calls() === 0) await Bun.sleep(1);
|
||||
result.switch({
|
||||
type: "oauth",
|
||||
|
||||
Reference in New Issue
Block a user