Files
oh-my-pi/packages/coding-agent/test/slash-commands/switch.test.ts
T
can1357 741558a6d4 feat(coding-agent): removed background mode command and runtime plumbing
- Removed the built-in `background` (`bg`) slash command and its `handleBackgroundCommand` path from the interactive flow.
- Deleted background event subscription and shutdown handling by removing `handleBackgroundEvent` from the event, input, and interactive controllers.
- Simplified `InteractiveModeContext` by dropping background-only fields and helpers such as `isBackgrounded`, background UI context creation, and background event callbacks.
2026-06-07 05:43:59 +02:00

31 lines
952 B
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("/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("");
});
});