Skip to content

Commit f469c60

Browse files
author
Matthew Cantelon
committed
refactor: remove context.done and replace with object return
Continues work started in probot#18
1 parent 796e0a1 commit f469c60

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ module.exports.serverless = appFn => {
6565

6666
// Bail for null body
6767
if (!event.body) {
68-
return context.done(null, {
68+
return {
6969
statusCode: 400,
7070
body: 'Event body is null.'
71-
})
71+
}
7272
}
7373

7474
// Do the thing

tests/index.test.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,8 @@ describe('serverless-lambda', () => {
4949
}
5050
}
5151

52-
await handler(event, context)
53-
expect(context.done).toHaveBeenCalledWith(null, expect.objectContaining({
54-
statusCode: 400
55-
}))
52+
const result = await handler(event, context)
53+
expect(result.statusCode).toBe(400)
5654
expect(spy).not.toHaveBeenCalled()
5755
})
5856

0 commit comments

Comments
 (0)