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(x402-pay): let the keypair-less fs mock still read data/plans.json so the routing suite loads again

nirholas6e9ff57d5c2f
diff --git a/tests/api/x402-pay-routing.test.js b/tests/api/x402-pay-routing.test.js
index 36172b9c6..28cafbf8f 100644
--- a/tests/api/x402-pay-routing.test.js
+++ b/tests/api/x402-pay-routing.test.js
@@ -36,12 +36,17 @@ vi.mock('../../api/_lib/db.js', () => ({ sql: vi.fn(async () => []), isDbUnavail
// No shared platform wallet configured + no dev keypair file → loadAgentKeypair()
// throws config-missing, which is the deterministic outcome we assert for the
-// fallback path (the warn must already have fired before this throws).
-vi.mock('node:fs', () => ({
- readFileSync: () => {
+// fallback path (the warn must already have fired before this throws). Static
+// data the import graph reads at load (data/plans.json for the payments config)
+// still comes off disk.
+vi.mock('node:fs', async (importActual) => {
+ const actual = await importActual();
+ const readFileSync = (path, ...rest) => {
+ if (String(path).endsWith('/data/plans.json')) return actual.readFileSync(path, ...rest);
throw new Error('no dev keypair');
- },
-}));
+ };
+ return { ...actual, default: { ...actual, readFileSync }, readFileSync };
+});
delete process.env.X402_AGENT_SOLANA_SECRET_BASE58;