(client: SqliteDataMigrationClient)
| 10 | const now = 1_780_000_000_000; |
| 11 | |
| 12 | const makeFakeD1 = (client: SqliteDataMigrationClient): D1Database => { |
| 13 | const prepare = (sql: string) => { |
| 14 | const statement = (args: readonly unknown[]): Record<string, unknown> => ({ |
| 15 | bind: (...values: readonly unknown[]) => statement([...args, ...values]), |
| 16 | all: async () => { |
| 17 | const result = await client.execute({ sql, args }); |
| 18 | return { success: true, meta: {}, results: result.rows }; |
| 19 | }, |
| 20 | run: async () => { |
| 21 | await client.execute({ sql, args }); |
| 22 | return { success: true, meta: {}, results: [] }; |
| 23 | }, |
| 24 | }); |
| 25 | return statement([]); |
| 26 | }; |
| 27 | |
| 28 | // oxlint-disable-next-line executor/no-double-cast -- test double: only the D1 methods used by the migration runner are implemented |
| 29 | return { |
| 30 | prepare, |
| 31 | withSession: () => ({ prepare }), |
| 32 | } as unknown as D1Database; |
| 33 | }; |
| 34 | |
| 35 | const makeFakeR2 = (): { |
| 36 | readonly bucket: R2Bucket; |
no outgoing calls
no test coverage detected