()
| 197 | * auto-expire after one call. |
| 198 | */ |
| 199 | export function resetDbChainMock(): void { |
| 200 | select.mockImplementation(() => ({ from })) |
| 201 | selectDistinct.mockImplementation(() => ({ from })) |
| 202 | selectDistinctOn.mockImplementation(() => ({ from })) |
| 203 | from.mockImplementation(joinBuilder) |
| 204 | innerJoin.mockImplementation(joinBuilder) |
| 205 | leftJoin.mockImplementation(joinBuilder) |
| 206 | where.mockImplementation(whereBuilder) |
| 207 | insert.mockImplementation(() => ({ values })) |
| 208 | values.mockImplementation(() => ({ returning, onConflictDoUpdate, onConflictDoNothing })) |
| 209 | onConflictDoUpdate.mockImplementation(() => ({ returning }) as unknown as Promise<void>) |
| 210 | onConflictDoNothing.mockImplementation(() => ({ returning }) as unknown as Promise<void>) |
| 211 | update.mockImplementation(() => ({ set })) |
| 212 | set.mockImplementation(() => ({ where })) |
| 213 | del.mockImplementation(() => ({ where })) |
| 214 | limit.mockImplementation(() => Promise.resolve([] as unknown[])) |
| 215 | orderBy.mockImplementation(terminalBuilder) |
| 216 | returning.mockImplementation(() => Promise.resolve([] as unknown[])) |
| 217 | having.mockImplementation(terminalBuilder) |
| 218 | groupBy.mockImplementation(() => { |
| 219 | const builder = terminalBuilder() |
| 220 | builder.having = having |
| 221 | return builder |
| 222 | }) |
| 223 | execute.mockImplementation(() => Promise.resolve([] as unknown[])) |
| 224 | forClause.mockImplementation(forBuilder) |
| 225 | transaction.mockImplementation(async (cb: (tx: typeof dbChainMock.db) => unknown) => |
| 226 | cb(dbChainMock.db) |
| 227 | ) |
| 228 | } |
| 229 | |
| 230 | /** |
| 231 | * Static mock module for `@sim/db` backed by `dbChainMockFns`. |
no test coverage detected