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(leaderboard): let the rollup cron's sql mock pass nested fragments through instead of eating a queued result

nirholas664f3da0f872
diff --git a/tests/api/leaderboard-rollup-cron.test.js b/tests/api/leaderboard-rollup-cron.test.js
index 72ba73e81..9e12876da 100644
--- a/tests/api/leaderboard-rollup-cron.test.js
+++ b/tests/api/leaderboard-rollup-cron.test.js
@@ -13,8 +13,13 @@ import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
const sqlMock = vi.fn(async () => []);
const unlockBadge = vi.fn(async () => true);
+// A query helper may build a clause as a nested sql`` fragment (launch-counts.js
+// does, for its LIMIT). Only a statement that selects is a query that runs, so
+// fragments pass through without consuming a queued result.
+const isFragment = (strings) => !/\bselect\b/i.test(strings.join(''));
+
vi.mock('../../api/_lib/db.js', () => ({
- sql: sqlMock,
+ sql: (strings, ...values) => (isFragment(strings) ? { strings, values } : sqlMock(strings, ...values)),
isDbUnavailableError: () => false,
isDbCapacityError: () => false,
isStoragePressured: async () => ({ pressured: false }),