Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
test: pin file_list BigInt normalization against the ctx-engine seam (#3869 rider)
test3e4bc112d8cc
diff --git a/test/files.test.ts b/test/files.test.tsindex 897c5f4119..8367b29254 100644--- a/test/files.test.ts+++ b/test/files.test.ts@@ -217,23 +217,21 @@ describe('collectFiles (production import)', () => {mime_type: null, size_bytes: null, content_hash: 'h2',created_at: '2026-04-27' },];- const fakeSql: any = (..._: unknown[]) => Promise.resolve(fakeRows);- const spy = spyOn(db, 'getConnection').mockReturnValue(fakeSql);-- try {- const op = operationsByName['file_list'];- const ctx: any = { engine: null, config: {}, logger: { info() {}, warn() {}, error() {} }, dryRun: false, remote: true };- const result = await op.handler(ctx, {}) as Array<Record<string, unknown>>;-- expect(result.length).toBe(2);- expect(typeof result[0].size_bytes).toBe('number');- expect(result[0].size_bytes).toBe(4096);- expect(result[1].size_bytes).toBeNull();- // The exact failure mode openclaw reported.- expect(() => JSON.stringify(result)).not.toThrow();- } finally {- spy.mockRestore();- }+ // file_list now routes through the connected OperationContext engine+ // (sqlQueryForEngine) instead of the module-global db connection; pin the+ // same BigInt invariant against the new seam.+ const fakeEngine: any = { executeRaw: async () => fakeRows };++ const op = operationsByName['file_list'];+ const ctx: any = { engine: fakeEngine, config: {}, logger: { info() {}, warn() {}, error() {} }, dryRun: false, remote: true };+ const result = await op.handler(ctx, {}) as Array<Record<string, unknown>>;++ expect(result.length).toBe(2);+ expect(typeof result[0].size_bytes).toBe('number');+ expect(result[0].size_bytes).toBe(4096);+ expect(result[1].size_bytes).toBeNull();+ // The exact failure mode openclaw reported.+ expect(() => JSON.stringify(result)).not.toThrow();});test('collectFiles skips node_modules', () => {