From fd6fd98a1cafc99cdda5b255b2db2ec5a3743c79 Mon Sep 17 00:00:00 2001 From: Jonas Jesus Date: Mon, 22 Jun 2026 11:54:59 -0300 Subject: [PATCH] test(cms): add regression test for site app detection on TanStack Start sites TanStack Start's composeMeta does not register site/apps/site.ts in manifest.blocks.apps, causing findSiteAppEntry to return null for these sites. The canonical 'site' key is now trusted directly via isSiteAppBlock. This test documents and guards that behavior. Co-Authored-By: Claude Sonnet 4.6 --- .../sections-editor/page-list.test.ts | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/apps/mesh/src/web/components/sections-editor/page-list.test.ts b/apps/mesh/src/web/components/sections-editor/page-list.test.ts index 5ebcad33d5..8f69c364ab 100644 --- a/apps/mesh/src/web/components/sections-editor/page-list.test.ts +++ b/apps/mesh/src/web/components/sections-editor/page-list.test.ts @@ -164,6 +164,37 @@ describe("page-list", () => { }); }); + it("findSiteAppEntry resolves site app on TanStack Start sites (no manifest apps block)", () => { + // TanStack Start's composeMeta only generates sections/pages/loaders/actions/matchers — + // it does not register site/apps/site.ts in manifest.blocks.apps. The function + // should still return the entry because the canonical "site" key is trusted directly. + const meta: LiveMeta = { + manifest: { + blocks: { + sections: { + "site/sections/Header.tsx": { $ref: "#/definitions/Header" }, + }, + pages: {}, + loaders: {}, + }, + }, + schema: {}, + }; + const decofile = { + site: { + __resolveType: "site/apps/site.ts", + seo: { title: "Home" }, + platform: "vtex", + }, + }; + + expect(findSiteAppEntry(decofile, meta)).toEqual({ + key: "site", + name: "Site", + resolveType: "site/apps/site.ts", + }); + }); + it("extractGlobalSections uses catalog filters for saved blocks", () => { const meta: LiveMeta = { manifest: {