feat: expose assistant global shortcuts

This commit is contained in:
ajnart committed 2026-08-14 11:32:10 +02:00
1 parent 4b647ec2c9
commit 73e4b80a26
9 files changed
+90 -28

No files matched your search

@@ -3,9 +3,27 @@ import { describe, expect, it, vi } from "vitest";
import { createAssistantPromptInteraction } from "./assistant-spotlight";
describe("createAssistantPromptInteraction", () => {
it("sends an existing default-search query immediately", () => {
const sendPrompt = vi.fn();
const interaction = createAssistantPromptInteraction({
sendPrompt,
prompt: " Check my services ",
});
expect(interaction.type).toBe("javaScript");
if (interaction.type !== "javaScript") return;
interaction.onSelect();
expect(interaction.closeSpotlightOnTrigger).toBe(true);
expect(sendPrompt).toHaveBeenCalledWith("Check my services");
});
it("keeps Spotlight open when the prompt is empty", () => {
const sendPrompt = vi.fn();
const interaction = createAssistantPromptInteraction({ sendPrompt });
expect(interaction.type).toBe("children");
if (interaction.type !== "children") return;
const [action] = interaction.useActions({}, " ");
expect(action).toBeDefined();
if (!action) return;
@@ -22,6 +40,9 @@ describe("createAssistantPromptInteraction", () => {
it("trims and sends a prompt in the background", () => {
const sendPrompt = vi.fn();
const interaction = createAssistantPromptInteraction({ sendPrompt });
expect(interaction.type).toBe("children");
if (interaction.type !== "children") return;
const [action] = interaction.useActions({}, " Check my services ");
expect(action).toBeDefined();
if (!action) return;