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): numeric sort comparator in crypto-whales suite; record 14/14 green run

fudjiac873f5fd2a5b
diff --git a/prompts/x402-overhaul/PROGRESS.md b/prompts/x402-overhaul/PROGRESS.md
index 15be16698..c2c480a04 100644
--- a/prompts/x402-overhaul/PROGRESS.md
+++ b/prompts/x402-overhaul/PROGRESS.md
@@ -505,6 +505,15 @@ path verified end-to-end via `scanTokenWhales`/`scanMarketWhales` (output above)
The vitest file mirrors those exact assertions; re-run
`npx vitest run tests/crypto-whales.test.js` once the install storm settles.
+**2026-07-07 follow-up — test re-run done.** `npx vitest run
+tests/crypto-whales.test.js` now runs clean: **14/14 pass**. One assertion had a
+test-side bug (numeric array compared via comparator-less `.sort()`, which sorts
+lexicographically — `[10, 5]` stays `[10, 5]` because `"10" < "5"`); fixed with
+`.sort((a, b) => a - b)`. Production re-verified live the same day: market scope
+(`?minSol=3&limit=3`) returned 31 whales / 468.4 SOL / `bearish`, and token scope
+for `$THREE` returned three ≥5 SOL buys with real tx hashes. Prompt 06 DoD fully
+closed.
+
**Adjacent gaps noticed (for other prompts):**
- Prompt 10 owns `api/_lib/crypto-catalog/index.js` (assembler), `api/crypto/index.js`,
`/api/crypto/openapi.json`, the `/docs/crypto-api` page registration in
diff --git a/tests/crypto-whales.test.js b/tests/crypto-whales.test.js
index e5b703a7a..412680674 100644
--- a/tests/crypto-whales.test.js
+++ b/tests/crypto-whales.test.js
@@ -61,7 +61,7 @@ describe('buildWhaleResult — threshold filter', () => {
const trades = [buy('W1', 10), buy('W2', 4.9), buy('W3', 5)];
const r = buildWhaleResult({ trades, scope: 'token', mint: THREE_MINT, minSol: 5, limit: 10 });
expect(r.whaleCount).toBe(2);
- expect(r.whales.map((w) => w.solMoved).sort()).toEqual([5, 10]);
+ expect(r.whales.map((w) => w.solMoved).sort((a, b) => a - b)).toEqual([5, 10]);
expect(r.totalSolMoved).toBe(15);
});
});