( kiloclawFetch: ReturnType<typeof vi.fn>, idempotencyStub = createMockIdempotencyStub() )
| 33 | } |
| 34 | |
| 35 | function createMockEnv( |
| 36 | kiloclawFetch: ReturnType<typeof vi.fn>, |
| 37 | idempotencyStub = createMockIdempotencyStub() |
| 38 | ) { |
| 39 | const queueSend = vi.fn().mockResolvedValue(undefined); |
| 40 | const idFromName = vi.fn().mockReturnValue('do-id'); |
| 41 | const env = { |
| 42 | KILOCLAW: { fetch: kiloclawFetch } as unknown as Fetcher, |
| 43 | OIDC_AUDIENCE_BASE: 'https://kiloclaw-gmail.kiloapps.io', |
| 44 | INTERNAL_API_SECRET: { get: () => Promise.resolve('test-internal-secret') }, |
| 45 | GMAIL_PUSH_QUEUE: { send: queueSend } as unknown as Queue<GmailPushQueueMessage>, |
| 46 | IDEMPOTENCY: { |
| 47 | idFromName, |
| 48 | get: vi.fn().mockReturnValue(idempotencyStub), |
| 49 | }, |
| 50 | } as unknown as AppEnv; |
| 51 | return { env, queueSend, idFromName }; |
| 52 | } |
| 53 | |
| 54 | function createBatch( |
| 55 | messages: ReturnType<typeof createMockMessage>[] |
no test coverage detected