Move the use-case index onto Learn so the pilot stories stay reachable, and make share images resolve on the host that serves the page.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
adilalloandCursor committed 2026-11-03 20:28:04 -07:00
1 parent 18abeb56dd
commit 9ea3f9fd0a
27 files changed
+656 -419

No files matched your search

+9 -25
View File
@@ -1,35 +1,19 @@
import { describe, test, expect, vi } from "vitest";
import { screen } from "@testing-library/react";
import { renderWithProviders as render } from "../utils/test-utils";
import UseCasesPage from "../../app/(marketing)/use-cases/page";
import messages from "../../messages/en/index";
vi.mock("next/dynamic", () => ({
default: () => {
const Component = vi.fn(() => (
<section data-testid="related-articles">Related articles</section>
));
return Component;
},
const { redirect } = vi.hoisted(() => ({
redirect: vi.fn((url) => {
throw new Error(`NEXT_REDIRECT:${url}`);
}),
}));
vi.mock("next/link", () => ({
default: ({ children, href, ...props }) => (
<a href={href} {...props}>
{children}
</a>
),
vi.mock("next/navigation", () => ({
redirect,
}));
describe("UseCasesPage", () => {
const links = messages.pages.useCases.caseStudyTiles.links;
test("renders case study tiles as links to detail pages", () => {
render(<UseCasesPage />);
for (const link of links) {
const anchor = screen.getByRole("link", { name: link.ariaLabel });
expect(anchor).toHaveAttribute("href", link.href);
}
test("sends the use cases index to Learn", () => {
expect(() => UseCasesPage()).toThrow("NEXT_REDIRECT:/learn");
expect(redirect).toHaveBeenCalledWith("/learn");
});
});