5f63165637
- Added setup wizard with provider login, glyph mode, and theme scenes shown once per setup version. - Wired `omp setup` (no args) to trigger the wizard in a TTY; `--check`/`--json` still show help. - Extracted `gradientEscape` and exported `PI_LOGO`/`ShineConfig` from welcome for shared use in splash/outro. - Fixed race condition in `setSymbolPreset`/`setColorBlindMode` by tracking load request IDs.
34 lines
1.0 KiB
TypeScript
34 lines
1.0 KiB
TypeScript
import { describe, expect, it, vi } from "bun:test";
|
|
import type { InteractiveModeContext } from "@oh-my-pi/pi-coding-agent/modes/types";
|
|
import { executeBuiltinSlashCommand } from "@oh-my-pi/pi-coding-agent/slash-commands/builtin-registry";
|
|
|
|
function createRuntime() {
|
|
const showModelSelector = vi.fn();
|
|
const setText = vi.fn();
|
|
const handleBackgroundCommand = vi.fn();
|
|
return {
|
|
showModelSelector,
|
|
setText,
|
|
runtime: {
|
|
ctx: {
|
|
editor: { setText } as unknown as InteractiveModeContext["editor"],
|
|
showModelSelector,
|
|
handleBackgroundCommand,
|
|
} as unknown as InteractiveModeContext,
|
|
handleBackgroundCommand,
|
|
},
|
|
};
|
|
}
|
|
|
|
describe("/switch slash command", () => {
|
|
it("opens the temporary model selector (mirrors alt+p)", async () => {
|
|
const harness = createRuntime();
|
|
|
|
const handled = await executeBuiltinSlashCommand("/switch", harness.runtime);
|
|
|
|
expect(handled).toBe(true);
|
|
expect(harness.showModelSelector).toHaveBeenCalledWith({ temporaryOnly: true });
|
|
expect(harness.setText).toHaveBeenCalledWith("");
|
|
});
|
|
});
|