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): let the treasury mocks keep the real connection.js exports

nirholas7c4e5076b240
diff --git a/tests/treasury-selfheal-visibility.test.js b/tests/treasury-selfheal-visibility.test.js
index 8f09f84ac..2eacc62df 100644
--- a/tests/treasury-selfheal-visibility.test.js
+++ b/tests/treasury-selfheal-visibility.test.js
@@ -65,7 +65,10 @@ vi.mock('../api/_lib/economy-sweepback.js', () => ({
const sendOpsAlert = vi.hoisted(() => vi.fn(async () => {}));
vi.mock('../api/_lib/alerts.js', () => ({ sendOpsAlert }));
-vi.mock('../api/_lib/solana/connection.js', () => ({
+// Only the network call is stubbed; the module's other exports (isTransientRpcError)
+// keep their real behaviour so this mock cannot drift out of its export list.
+vi.mock('../api/_lib/solana/connection.js', async (importOriginal) => ({
+ ...(await importOriginal()),
// The master sits under RESERVE_SOL + operating headroom, so there is a real
// deficit and both reclaim legs are reached. This is the 07-29 balance.
solanaConnection: () => ({ getBalance: vi.fn(async () => 3_843_137) }),
diff --git a/tests/treasury-topup-alias.test.js b/tests/treasury-topup-alias.test.js
index 042866871..ec08861b5 100644
--- a/tests/treasury-topup-alias.test.js
+++ b/tests/treasury-topup-alias.test.js
@@ -60,7 +60,10 @@ vi.mock('../api/_lib/economy-sweepback.js', () => ({
reclaimIdleSol: vi.fn(async () => ({ reclaimedSol: 0, moves: [], skipped: [], failed: [] })),
}));
vi.mock('../api/_lib/alerts.js', () => ({ sendOpsAlert: vi.fn(async () => {}) }));
-vi.mock('../api/_lib/solana/connection.js', () => ({
+// Only the network call is stubbed; the module's other exports (isTransientRpcError)
+// keep their real behaviour so this mock cannot drift out of its export list.
+vi.mock('../api/_lib/solana/connection.js', async (importOriginal) => ({
+ ...(await importOriginal()),
// Every wallet reads under-floor so both candidate specs would qualify as
// targets if the alias guard failed.
solanaConnection: () => ({ getBalance: vi.fn(async () => 10_000_000) }),
diff --git a/tests/treasury-topup-shared-wallet.test.js b/tests/treasury-topup-shared-wallet.test.js
index a9fff1b4d..834e50196 100644
--- a/tests/treasury-topup-shared-wallet.test.js
+++ b/tests/treasury-topup-shared-wallet.test.js
@@ -68,7 +68,11 @@ vi.mock('../api/_lib/economy-sweepback.js', () => ({
reclaimIdleAgentSol: vi.fn(async () => ({ reclaimedSol: 0, moves: [], skipped: [], failed: [] })),
}));
vi.mock('../api/_lib/alerts.js', () => ({ sendOpsAlert: vi.fn(async () => {}) }));
-vi.mock('../api/_lib/solana/connection.js', () => ({
+// Only the network call is stubbed. Everything else (notably isTransientRpcError,
+// which the handler consults to decide whether a read failure is retryable) keeps
+// its real behaviour, so this mock cannot drift out of the module's export list.
+vi.mock('../api/_lib/solana/connection.js', async (importOriginal) => ({
+ ...(await importOriginal()),
// 0.012 SOL everywhere: above the relayer's 0.01 floor, below the
// circulation treasury's 0.2 and the loner's 0.02.
solanaConnection: () => ({ getBalance: vi.fn(async () => 12_214_000) }),