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): reject the healthz db mock asynchronously so tagged-template fragments still import

nirholasfa8082798d33
diff --git a/tests/api/healthz.test.js b/tests/api/healthz.test.js
index 29354f32b..533f5d26a 100644
--- a/tests/api/healthz.test.js
+++ b/tests/api/healthz.test.js
@@ -11,8 +11,14 @@ vi.mock('../../api/_lib/sentry.js', () => ({ captureException: () => {} }));
// gracefully. Without this mock the build would query the production DB, where
// a stale bot_heartbeat row flips monitor.running to false and fails the smoke
// test non-deterministically.
+// `sql` is a tagged template that modules also use at import time to build
+// reusable column fragments (api/_lib/home/store.js), so a mock that throws
+// synchronously kills the import of anything on that chain before a single
+// test runs. Hand back a thenable that rejects instead: fragment construction
+// succeeds, every awaited query fails, and that is what a DB outage actually
+// looks like to the handler's `try { await sql`…` } catch` blocks.
vi.mock('../../api/_lib/db.js', () => ({
- sql: () => { throw new Error('no database in test'); },
+ sql: () => ({ then: (_resolve, reject) => reject(new Error('no database in test')) }),
isDbUnavailableError: () => false,
isDbCapacityError: () => false,
}));