Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

test(mcp): stub the public CDN read the asset catalog now imports

nirholasea474ed116be
diff --git a/tests/api/mcp-asset-catalog.test.js b/tests/api/mcp-asset-catalog.test.js
index 71309e494..bad45cfce 100644
--- a/tests/api/mcp-asset-catalog.test.js
+++ b/tests/api/mcp-asset-catalog.test.js
@@ -2,10 +2,11 @@
// under them: the manifest join (api/_lib/asset-catalog.js) and the snippet
// builder (api/_lib/asset-snippets.js).
//
-// R2 is stubbed with manifests shaped exactly like the published ones (the
-// field names and the "collection: x" category convention come from the live
-// objects/avatars/animations manifests), so the suite exercises the real join,
-// the real ranking, and the real code generation without a network call.
+// The public CDN read (r2.getPublicObjectBuffer, the export asset-catalog.js
+// actually imports) is stubbed with manifests shaped exactly like the published
+// ones: the field names and the "collection: x" category convention come from
+// the live objects/avatars/animations manifests, so the suite exercises the real
+// join, the real ranking, and the real code generation without a network call.
import { describe, it, expect, beforeEach, vi } from 'vitest';
@@ -68,7 +69,7 @@ const MANIFESTS = {
'animations/library/generated/manifest.json': null,
};
-const getObjectBuffer = vi.fn(async (key) => {
+const getPublicObjectBuffer = vi.fn(async (key) => {
const value = MANIFESTS[key];
if (value == null) {
const err = new Error('NoSuchKey');
@@ -78,7 +79,7 @@ const getObjectBuffer = vi.fn(async (key) => {
return Buffer.from(JSON.stringify(value), 'utf8');
});
-vi.mock('../../api/_lib/r2.js', () => ({ getObjectBuffer }));
+vi.mock('../../api/_lib/r2.js', () => ({ getPublicObjectBuffer }));
const { searchCatalog, getCatalogItem, relatedItems, resetCatalogCache } = await import(
'../../api/_lib/asset-catalog.js'
@@ -94,7 +95,7 @@ const req = { headers: { host: 'three.ws' } };
beforeEach(() => {
resetCatalogCache();
- getObjectBuffer.mockClear();
+ getPublicObjectBuffer.mockClear();
});
describe('catalog join', () => {
@@ -124,9 +125,9 @@ describe('catalog join', () => {
it('memoizes the manifests so repeat searches do not re-read storage', async () => {
await searchCatalog({ q: 'chair' });
- const afterFirst = getObjectBuffer.mock.calls.length;
+ const afterFirst = getPublicObjectBuffer.mock.calls.length;
await searchCatalog({ q: 'wrench' });
- expect(getObjectBuffer.mock.calls.length).toBe(afterFirst);
+ expect(getPublicObjectBuffer.mock.calls.length).toBe(afterFirst);
});
});