Files
oh-my-pi/packages/coding-agent/test/slash-commands/switch.test.ts
T
roboomp 5af43e8285 fix(coding-agent): restored /model role picker
- Routed the /model TUI slash command back to the full model setup picker.
- Kept /switch on the temporary session model selector and updated slash-command coverage.

Fixes #2933
2026-06-18 05:27:22 +00:00

43 lines
1.3 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();
return {
showModelSelector,
setText,
runtime: {
ctx: {
editor: { setText } as unknown as InteractiveModeContext["editor"],
showModelSelector,
} as unknown as InteractiveModeContext,
},
};
}
describe("/model slash command", () => {
it("opens the model setup picker for role and thinking assignment", async () => {
const harness = createRuntime();
const handled = await executeBuiltinSlashCommand("/model", harness.runtime);
expect(handled).toBe(true);
expect(harness.showModelSelector.mock.calls).toEqual([[]]);
expect(harness.setText).toHaveBeenCalledWith("");
});
});
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("");
});
});