mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-11-05 23:37:25 +00:00
fix(ai): advance fake timers until Copilot login settles in OAuth test
models.login loads the OAuth flow module through a URL import since 5c6ce2b32, which takes real I/O under vitest. A single 1000ms fake-timer advance ran before the device flow started, leaving the poll wait unadvanced and the test hanging.
This commit is contained in:
parent
c5d98a78ed
commit
8eddfe82ff
1 changed files with 8 additions and 1 deletions
|
|
@ -467,7 +467,14 @@ describe("GitHub Copilot OAuth device flow", () => {
|
|||
notify: () => {},
|
||||
});
|
||||
|
||||
await vi.advanceTimersByTimeAsync(1000);
|
||||
// models.login loads the flow module with real I/O before the device flow starts,
|
||||
// so keep moving the fake clock until login settles instead of advancing once.
|
||||
let settled = false;
|
||||
const markSettled = () => {
|
||||
settled = true;
|
||||
};
|
||||
loginPromise.then(markSettled, markSettled);
|
||||
while (!settled) await vi.advanceTimersByTimeAsync(1000);
|
||||
const credential = await loginPromise;
|
||||
expect(credential).toMatchObject({ type: "oauth", access: testCopilotAccessToken });
|
||||
expect(policyModelIds).toEqual([firstModelId]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue