test(surface): read the default catalog as optional under a2ui 0.14

a2ui 0.14 types SurfaceModel.defaultCatalog as possibly undefined. Studio's
surface always names its catalog in createSurface, so the catalogue checks
still hold; an absent catalog now fails them rather than the type check.
This commit is contained in:
esengine committed 2026-11-01 04:37:51 -08:00
1 parent 14dbabfec2
commit ba6bf964bb
1 file changed
+5 -4
@@ -26,9 +26,10 @@ it("maps field ids to safe bindings and returns typed values from the library da
it("does not expose executable components or library functions through the Studio catalogue", () => {
const runtime = createSurfaceRuntime([{ kind: "text", value: '<script>bad</script> {"path":"/secret"}' }]);
try {
expect(runtime.surface.defaultCatalog.functions.size).toBe(0);
expect(runtime.surface.defaultCatalog.components.has("Image")).toBe(false);
expect(runtime.surface.defaultCatalog.components.has("Video")).toBe(false);
expect(runtime.surface.defaultCatalog.components.has("Modal")).toBe(false);
const catalog = runtime.surface.defaultCatalog;
expect(catalog?.functions.size).toBe(0);
expect(catalog?.components.has("Image")).toBe(false);
expect(catalog?.components.has("Video")).toBe(false);
expect(catalog?.components.has("Modal")).toBe(false);
} finally { runtime.dispose(); }
});