mirror of
https://github.com/vercel/eve.git
synced 2026-09-20 05:35:39 +08:00
bf04750363
Signed-off-by: John Pham <john.pham@vercel.com>
27 lines
955 B
TypeScript
27 lines
955 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { markdownRoutes } from "./markdown-routes";
|
|
|
|
const integrationsRoute = markdownRoutes.find(({ from }) => from === "/integrations/*path");
|
|
|
|
const rewriteIntegration = (path: string): string | undefined => {
|
|
if (!integrationsRoute || typeof integrationsRoute.to !== "string") return;
|
|
return integrationsRoute.to.replace("[lang]", "en").replace("*path", path);
|
|
};
|
|
|
|
describe("markdownRoutes", () => {
|
|
it("maps valid integration Markdown requests to the shared route", () => {
|
|
expect(rewriteIntegration("slack")).toBe("/en/llms.mdx/integrations/slack");
|
|
});
|
|
|
|
it("maps missing integrations to the smart Markdown handler", () => {
|
|
expect(rewriteIntegration("slak")).toBe("/en/llms.mdx/integrations/slak");
|
|
});
|
|
|
|
it("keeps docs Markdown routing intact", () => {
|
|
expect(markdownRoutes).toContainEqual({
|
|
from: "/docs/*path",
|
|
to: "/[lang]/llms.mdx/*path",
|
|
});
|
|
});
|
|
});
|