forked from bai/curriculum-project-hub
feat: redesign Feishu project console
This commit is contained in:
@@ -274,7 +274,7 @@ function mockPrisma(): PrismaClient {
|
||||
create: vi.fn(async () => ({ id: "receipt-1" })),
|
||||
},
|
||||
projectGroupBinding: {
|
||||
findFirst: vi.fn(async () => ({ projectId: "project-1" })),
|
||||
findFirst: vi.fn(async () => ({ projectId: "project-1", selectedRole: { roleId: "draft" } })),
|
||||
},
|
||||
project: {
|
||||
findUnique: vi.fn(async () => ({ workspaceDir: "/tmp/cph-project" })),
|
||||
|
||||
@@ -1,17 +1,11 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { parseSlashHelpSubcommand, parseSlashInvocation } from "../../src/feishu/slashCommands.js";
|
||||
import { parseSlashInvocation } from "../../src/feishu/slashCommands.js";
|
||||
|
||||
describe("slash command parser", () => {
|
||||
it("parses a slash invocation without resolving it", () => {
|
||||
expect(parseSlashInvocation("/new")).toEqual({ name: "new", args: [] });
|
||||
expect(parseSlashInvocation("/review 看看这节")).toEqual({ name: "review", args: ["看看这节"] });
|
||||
expect(parseSlashInvocation("/project")).toEqual({ name: "project", args: [] });
|
||||
expect(parseSlashInvocation("/usage project")).toEqual({ name: "usage", args: ["project"] });
|
||||
expect(parseSlashInvocation("写教案")).toBeNull();
|
||||
});
|
||||
|
||||
it("parses help subcommands only in the exact /<command> help form", () => {
|
||||
expect(parseSlashHelpSubcommand({ name: "new", args: ["help"] })).toBe("new");
|
||||
expect(parseSlashHelpSubcommand({ name: "unknown", args: ["help"] })).toBe("unknown");
|
||||
expect(parseSlashHelpSubcommand({ name: "new", args: ["help", "please"] })).toBeNull();
|
||||
expect(parseSlashHelpSubcommand({ name: "help", args: ["new"] })).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -117,6 +117,8 @@ function makeTrigger(prompt: string): Omit<QueuedTrigger, "projectId" | "enqueue
|
||||
return {
|
||||
chatId: "chat-1",
|
||||
prompt,
|
||||
roleId: "draft",
|
||||
executionKind: "conversation",
|
||||
msg: makeMessage(prompt),
|
||||
senderOpenId: "ou-user",
|
||||
actor: { feishuOpenId: "ou-user", chatId: "chat-1" },
|
||||
|
||||
Reference in New Issue
Block a user