53 lines
2.0 KiB
TypeScript
53 lines
2.0 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
|
|
import {
|
|
CHAT_MODULE_KEY,
|
|
chatArchivedPath,
|
|
chatAuditAttachmentPath,
|
|
chatAuditPath,
|
|
chatChannelInfoPath,
|
|
chatChannelPath,
|
|
chatChannelSettingsPath,
|
|
chatFilesPath,
|
|
chatIndexPath,
|
|
chatMentionsPath,
|
|
chatNewPath,
|
|
chatNotFoundResponse,
|
|
chatPinnedPath,
|
|
chatSearchPath,
|
|
chatThreadPath,
|
|
} from "./chatRoutePaths";
|
|
|
|
describe("chat route paths", () => {
|
|
it("uses the canonical chat module key and tenant-scoped collection paths", () => {
|
|
expect(CHAT_MODULE_KEY).toBe("chat");
|
|
expect(chatIndexPath("acme")).toBe("/acme/chat");
|
|
expect(chatNewPath("acme")).toBe("/acme/chat/new");
|
|
expect(chatMentionsPath("acme")).toBe("/acme/chat/mentions");
|
|
expect(chatSearchPath("acme")).toBe("/acme/chat/search");
|
|
expect(chatArchivedPath("acme")).toBe("/acme/chat/archived");
|
|
});
|
|
|
|
it("builds channel, thread, pin, and file paths without changing identifiers", () => {
|
|
expect(chatChannelPath("acme", "chat_1")).toBe("/acme/chat/chat_1");
|
|
expect(chatChannelSettingsPath("acme", "chat_1")).toBe("/acme/chat/chat_1/settings");
|
|
expect(chatChannelInfoPath("acme", "chat_1")).toBe("/acme/chat/chat_1/info");
|
|
expect(chatThreadPath("acme", "chat_1", "thread_1")).toBe("/acme/chat/chat_1/thread/thread_1");
|
|
expect(chatPinnedPath("acme", "chat_1")).toBe("/acme/chat/chat_1/pinned");
|
|
expect(chatFilesPath("acme", "chat_1")).toBe("/acme/chat/chat_1/files");
|
|
});
|
|
|
|
it("uses the compliance hub for audit screens while keeping the published attachment endpoint stable", () => {
|
|
expect(chatAuditPath("acme")).toBe("/acme/settings/compliance/chat");
|
|
expect(chatAuditAttachmentPath("acme", "chat/1", "file/1", "preview")).toBe(
|
|
"/acme/settings/chat/audit/chat%2F1/attachments/file%2F1/preview"
|
|
);
|
|
});
|
|
|
|
it("provides the standard opaque not-found response", async () => {
|
|
const response = chatNotFoundResponse();
|
|
expect(response.status).toBe(404);
|
|
expect(await response.text()).toBe("Not Found");
|
|
});
|
|
});
|