test(21-00): add Wave 0 test stubs for chat service, routes, markdown, and input

This commit is contained in:
Nexus Dev 2026-04-01 16:43:19 +00:00
parent d72ccfbb2c
commit ecc293a49c
4 changed files with 117 additions and 0 deletions

View file

@ -0,0 +1,35 @@
import { describe, it } from "vitest";
describe("chatRoutes", () => {
describe("POST /companies/:companyId/conversations", () => {
it.todo("creates a conversation and returns 201");
it.todo("accepts optional title and agentId");
});
describe("GET /companies/:companyId/conversations", () => {
it.todo("returns paginated conversation list");
it.todo("supports cursor query param");
});
describe("GET /conversations/:id", () => {
it.todo("returns conversation by id");
it.todo("returns 404 for non-existent conversation");
});
describe("PATCH /conversations/:id", () => {
it.todo("updates conversation fields");
});
describe("DELETE /conversations/:id", () => {
it.todo("soft-deletes and returns 204");
});
describe("POST /conversations/:id/messages", () => {
it.todo("creates a message and returns 201");
it.todo("rejects invalid role");
});
describe("GET /conversations/:id/messages", () => {
it.todo("returns paginated message list");
});
});

View file

@ -0,0 +1,46 @@
import { describe, it } from "vitest";
describe("chatService", () => {
describe("createConversation", () => {
it.todo("creates a conversation row with companyId");
it.todo("returns the created conversation with id and timestamps");
});
describe("listConversations", () => {
it.todo("returns conversations sorted by updatedAt DESC");
it.todo("excludes soft-deleted conversations");
it.todo("supports cursor-based pagination with hasMore");
it.todo("limits results to max 100");
});
describe("getConversation", () => {
it.todo("returns conversation by id");
it.todo("throws notFound for non-existent conversation");
it.todo("throws notFound for soft-deleted conversation");
});
describe("updateConversation", () => {
it.todo("updates title");
it.todo("sets pinnedAt timestamp");
it.todo("clears pinnedAt when set to null");
it.todo("sets archivedAt timestamp");
it.todo("bumps updatedAt on every update");
});
describe("softDeleteConversation", () => {
it.todo("sets deletedAt timestamp");
it.todo("throws notFound if already deleted");
});
describe("addMessage", () => {
it.todo("inserts a message row with conversationId and role");
it.todo("bumps conversation updatedAt after insert");
it.todo("auto-sets title from first user message when title is null");
it.todo("does not overwrite existing title on subsequent messages");
});
describe("listMessages", () => {
it.todo("returns messages for conversation sorted by createdAt DESC");
it.todo("supports cursor-based pagination");
});
});

View file

@ -0,0 +1,19 @@
// @vitest-environment node
import { describe, it } from "vitest";
describe("ChatInput", () => {
describe("keyboard shortcuts (INPUT-07)", () => {
it.todo("calls onSend when Enter is pressed without Shift");
it.todo("inserts newline when Shift+Enter is pressed");
it.todo("clears input when Escape is pressed");
it.todo("does not send when input is empty");
});
describe("auto-resize (INPUT-01)", () => {
it.todo("textarea has max-height constraint");
});
describe("submit state", () => {
it.todo("disables send button when isSubmitting is true");
});
});

View file

@ -0,0 +1,17 @@
// @vitest-environment node
import { describe, it } from "vitest";
describe("ChatMarkdownMessage", () => {
describe("markdown rendering (CHAT-02)", () => {
it.todo("renders plain text as paragraph");
it.todo("renders code blocks with hljs classes for syntax highlighting");
it.todo("renders GFM tables");
it.todo("renders headings, lists, and links");
});
describe("code block features (CHAT-03)", () => {
it.todo("renders language label from code fence");
it.todo("renders copy button with aria-label");
it.todo("extracts code text content for clipboard");
});
});