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.

fix(tests): stop the cdn-object mock from hiding the storage-error branch

nirholas12d2e9b03fb6
diff --git a/tests/api/cdn-object.test.js b/tests/api/cdn-object.test.js
index 3b3ab6371..11b5e278f 100644
--- a/tests/api/cdn-object.test.js
+++ b/tests/api/cdn-object.test.js
@@ -15,7 +15,13 @@ vi.mock('../../api/_lib/env.js', () => ({ env: { S3_BUCKET: 'test-bucket' } }));
let sendImpl = async () => {
throw new Error('r2.send not stubbed for this test');
};
-vi.mock('../../api/_lib/r2.js', () => ({
+// Only the S3 client is stubbed. The rest of the module stays real, so the
+// handler's fallback branch is judged by the SAME `isStorageInfrastructureError`
+// production runs; a factory that returned `r2` alone left that import
+// undefined and turned every upstream 502 into a 500 the moment cdn-object.js
+// started importing it.
+vi.mock('../../api/_lib/r2.js', async (importOriginal) => ({
+ ...(await importOriginal()),
r2: { send: (...args) => sendImpl(...args) },
}));