Skip to content

Commit b1eff6e

Browse files
committed
test(idempotency): extend assertions
1 parent 6ab5310 commit b1eff6e

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

packages/idempotency/tests/e2e/makeHandlerIdempotent.test.ts

+10-3
Original file line numberDiff line numberDiff line change
@@ -263,9 +263,16 @@ describe('Idempotency E2E tests, middy middleware usage', () => {
263263
});
264264
expect(idempotencyRecords.Items?.[0].status).toEqual('COMPLETED');
265265

266-
// During the first invocation the function should timeout so the logs should contain 2 logs
267-
expect(functionLogs[0]).toHaveLength(2);
268-
expect(functionLogs[0][0]).toContain('Task timed out after');
266+
try {
267+
// During the first invocation the handler should be called, so the logs should contain 1 log
268+
expect(functionLogs[0]).toHaveLength(2);
269+
expect(functionLogs[0][0]).toContain('Task timed out after');
270+
} catch {
271+
// During the first invocation the function should timeout so the logs should not contain any log and the report log should contain a timeout message
272+
expect(functionLogs[0]).toHaveLength(0);
273+
expect(logs[0].getReportLog()).toMatch(/Status: timeout$/);
274+
}
275+
269276
// During the second invocation the handler should be called and complete, so the logs should
270277
// contain 1 log
271278
expect(functionLogs[1]).toHaveLength(1);

0 commit comments

Comments
 (0)