24 lines
1.0 KiB
TypeScript
24 lines
1.0 KiB
TypeScript
// @vitest-environment node
|
|
import { readFileSync } from "node:fs";
|
|
import path from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
const moduleDir = path.dirname(fileURLToPath(import.meta.url));
|
|
const editorSource = readFileSync(path.join(moduleDir, "ui/editor/index.tsx"), "utf8");
|
|
const slashCommandSource = readFileSync(path.join(moduleDir, "ui/editor/extensions/slash-command.tsx"), "utf8");
|
|
const uploadSource = readFileSync(path.join(moduleDir, "lib/utils/editor.ts"), "utf8");
|
|
|
|
describe("Novel editor routing", () => {
|
|
it("does not target disabled internal AI routes from active editor UI", () => {
|
|
expect(editorSource).not.toContain("internal/ai/generate");
|
|
expect(slashCommandSource).not.toContain("internal/ai/generate");
|
|
expect(uploadSource).not.toContain("internal/ai/upload");
|
|
});
|
|
|
|
it("uploads through the canonical API host with tenant scope", () => {
|
|
expect(uploadSource).toContain('apiPath("ai/upload"');
|
|
expect(uploadSource).toContain('"x-tenant-id": tenantId');
|
|
});
|
|
});
|