Files
vercel__eve/apps/docs/lib/geistdocs/metadata-title.test.ts
John Phamous 69f735bf4c Fix template title suffix (#1651)
Signed-off-by: John Pham <john.pham@vercel.com>
2026-08-05 18:56:18 +00:00

47 lines
1.5 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { describe, expect, it } from "vitest";
import {
formatPageTitle,
metadataTitle,
pageTitleMetadata,
rootTitleMetadata,
siteTitle,
} from "./metadata-title";
describe("metadata titles", () => {
it("defines normal child title inheritance at the shared layout", () => {
expect(rootTitleMetadata).toEqual({
default: "eve – durable AI agent framework",
template: "%s – eve",
});
expect(metadataTitle("Integrations")).toBe("Integrations");
expect(formatPageTitle("Integrations")).toBe("Integrations – eve");
});
it("keeps the homepage title absolute", () => {
expect(metadataTitle(siteTitle)).toEqual({ absolute: siteTitle });
expect(pageTitleMetadata(siteTitle)).toEqual({
title: { absolute: siteTitle },
openGraph: { title: siteTitle },
twitter: { title: siteTitle },
});
});
it.each(["Self-host eve", "Get started with eve: durable AI agents in TypeScript"])(
"does not suffix explicit standalone branding in %s",
(title) => {
expect(metadataTitle(title)).toEqual({ absolute: title });
expect(formatPageTitle(title)).toBe(title);
},
);
it("does not treat useEveAgent as standalone branding", () => {
const title = "Build an AI agent chat UI with useEveAgent";
expect(metadataTitle(title)).toBe(title);
expect(formatPageTitle(title)).toBe(`${title} – eve`);
});
it("applies the shared suffix to template titles", () => {
expect(formatPageTitle("Chat template")).toBe("Chat template – eve");
});
});