feat: add industry demo gallery and isolated site presentation
This commit is contained in:
@@ -75,3 +75,27 @@ test("simple content preview resolves only supported about route", () => {
|
||||
assert.equal(resolvePreviewPath("core.simplecontentpage", { meta: { slug: "about" } }), "/about");
|
||||
assert.equal(resolvePreviewPath("core.simplecontentpage", { meta: { slug: "unknown" } }), null);
|
||||
});
|
||||
|
||||
test("demo requests isolate industry paths and bypass shared caches", async () => {
|
||||
const calls = [];
|
||||
const { getDemoPage } = loadModule("services/demo.service.ts", {
|
||||
"./api-client": { fetchAPI: async (url, options) => { calls.push({ url, options }); return {}; } },
|
||||
});
|
||||
await getDemoPage("manufacturing", ["products", "precision-parts"]);
|
||||
await getDemoPage("consulting", ["about"]);
|
||||
assert.equal(calls[0].url, "/api/v1/custom/core/demos/manufacturing/?path=products%2Fprecision-parts");
|
||||
assert.equal(calls[1].url, "/api/v1/custom/core/demos/consulting/?path=about");
|
||||
assert.ok(calls.every((call) => call.options.revalidate === 0));
|
||||
});
|
||||
|
||||
test("default site chrome is hidden only on demo routes", () => {
|
||||
let pathname = "/demo/software/products";
|
||||
const { default: SiteChrome } = loadModule("components/layout/SiteChrome.tsx", {
|
||||
"next/navigation": { usePathname: () => pathname },
|
||||
});
|
||||
assert.equal(SiteChrome({ children: "default header" }), null);
|
||||
pathname = "/demo";
|
||||
assert.equal(SiteChrome({ children: "default header" }), null);
|
||||
pathname = "/products";
|
||||
assert.equal(SiteChrome({ children: "default header" }).props.children, "default header");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user