Skip to content

Commit 41217c1

Browse files
committed
chore: address reviewer feedback - fix import spacing and document mock-db limitations
1 parent 3c2592c commit 41217c1

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

common/src/testing/mock-db.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,21 @@ function createTableQuery<T>(data: T[]): TableQuery<T> {
211211
}
212212
}
213213

214-
/** Creates a mock database connection for testing billing functions. */
214+
/**
215+
* Creates a mock database connection for testing billing functions.
216+
*
217+
* **Limitation: Field-based Query Detection**
218+
*
219+
* This mock uses field inspection to determine what data to return from select queries.
220+
* The detection logic checks for specific field names in the select clause:
221+
* - `orgId` field → returns org member data
222+
* - `repoUrl` field → returns org repo data
223+
* - `totalCredits` field → returns referral sum data
224+
* - `principal` field → returns credit grant data
225+
*
226+
* If you add new queries with different field patterns, you may need to update the
227+
* `select()` implementation below to handle the new query type.
228+
*/
215229
export function createMockDb(config: MockDbConfig = {}): BillingDbConnection {
216230
const {
217231
users = [],

packages/agent-runtime/src/__tests__/fast-rewrite.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import path from 'path'
22

3-
43
import { createTestAgentRuntimeParams } from '@codebuff/common/testing/fixtures/agent-runtime'
54
import { beforeEach, describe, expect, it } from 'bun:test'
65
import { createPatch } from 'diff'

0 commit comments

Comments
 (0)