Skip to content

Commit

Permalink
add logger flush tests
Browse files Browse the repository at this point in the history
  • Loading branch information
joshbalfour committed Apr 12, 2024
1 parent 95b6058 commit d5bf2d1
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/modules/edge-api-sdk/tests/edge-api-sdk.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,20 @@ const testEventType = (generateRequest: RequestGenerator, generateResponse: Resp

expect(mockLoggerError).toHaveBeenCalled()
})

it('should flush the logger after an error is thrown', async () => {
const handler = jest.fn().mockRejectedValue(new Error(''))
await func(handler)(
generateRequest({
uri: '/',
env: {},
}),
{},
)

expect(mockLoggerError).toHaveBeenCalled()
expect(mockLoggerFlush).toHaveBeenCalled()
})
})

describe('config resolution', () => {
Expand Down

0 comments on commit d5bf2d1

Please sign in to comment.