(results: any[])
| 127 | |
| 128 | describe('.findPendingInvoices', () => { |
| 129 | function makePendingClient(results: any[]): DatabaseClient { |
| 130 | const selectStub = sandbox.stub().resolves(results) |
| 131 | const limitStub = sandbox.stub().returns({ select: selectStub }) |
| 132 | const offsetStub = sandbox.stub().returns({ limit: limitStub }) |
| 133 | const orderByStub = sandbox.stub().returns({ offset: offsetStub }) |
| 134 | const whereStub = sandbox.stub().returns({ orderBy: orderByStub }) |
| 135 | return sandbox.stub().returns({ where: whereStub }) as unknown as DatabaseClient |
| 136 | } |
| 137 | |
| 138 | it('returns empty array when no pending invoices exist', async () => { |
| 139 | const result = await repository.findPendingInvoices(0, 10, makePendingClient([])) |
no outgoing calls
no test coverage detected