(...counts: number[])
| 220 | } |
| 221 | |
| 222 | function mockProcessingCounts(...counts: number[]) { |
| 223 | const defaultWhere = dbChainMockFns.where.getMockImplementation() |
| 224 | if (!defaultWhere) throw new Error('Expected default where mock implementation') |
| 225 | let index = 0 |
| 226 | |
| 227 | dbChainMockFns.where.mockImplementation((condition: unknown) => { |
| 228 | if (isActiveScheduleExecutionCountCondition(condition) && index < counts.length) { |
| 229 | const count = counts[index] |
| 230 | index += 1 |
| 231 | return Promise.resolve([{ count }]) as ReturnType<typeof dbChainMockFns.where> |
| 232 | } |
| 233 | |
| 234 | return defaultWhere(condition) |
| 235 | }) |
| 236 | } |
| 237 | |
| 238 | function createMockRequest(): NextRequest { |
| 239 | const mockHeaders = new Map([ |
no test coverage detected