85219821ff
- Introduced OAuthManualInputManager and routed callback-server logins to await pasted redirect URLs with a visible tip. - Extended /login slash command to submit redirect URLs, block overlapping logins, and covered manual callbacks in tests. - Propagated onManualCodeInput through OAuth provider login helpers with a default authorization prompt. - Resolved docs index generation paths using path.resolve relative to the script directory.
32 lines
1015 B
TypeScript
32 lines
1015 B
TypeScript
import { describe, expect, it } from "bun:test";
|
|
import { OAuthManualInputManager } from "@oh-my-pi/pi-coding-agent/modes/oauth-manual-input";
|
|
|
|
describe("OAuthManualInputManager", () => {
|
|
it("resolves waitForInput with submitted value", async () => {
|
|
const manager = new OAuthManualInputManager();
|
|
const promise = manager.waitForInput("openai-codex");
|
|
|
|
const submitted = manager.submit("callback-url");
|
|
|
|
expect(submitted).toBe(true);
|
|
expect(await promise).toBe("callback-url");
|
|
expect(manager.hasPending()).toBe(false);
|
|
});
|
|
|
|
it("returns false when no pending input", () => {
|
|
const manager = new OAuthManualInputManager();
|
|
|
|
expect(manager.submit("callback-url")).toBe(false);
|
|
});
|
|
|
|
it("clears pending input and rejects promise", async () => {
|
|
const manager = new OAuthManualInputManager();
|
|
const promise = manager.waitForInput("anthropic");
|
|
|
|
manager.clear();
|
|
|
|
await expect(promise).rejects.toThrow("Manual OAuth input cleared");
|
|
expect(manager.submit("late-url")).toBe(false);
|
|
});
|
|
});
|