-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update for Middy v2 async API * Update middleware signature * Update tests * Update meta * Add middy as a peer dep
- Loading branch information
1 parent
3618ace
commit b88f8ab
Showing
5 changed files
with
68 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,21 @@ | ||
const middy = require('middy'); | ||
const middyBeeline = require('.'); | ||
|
||
describe('middy-beeline', () => { | ||
it('should extract keys', (done) => { | ||
const handler = middy((event, context, callback) => { | ||
callback(null, event.extracted); | ||
it('should extract keys', () => { | ||
const middleware = middyBeeline({ | ||
writeKey: 'key', | ||
serviceName: 'myService', | ||
dataset: 'myDataset', | ||
samplerHook: () => false, | ||
}); | ||
|
||
handler.use( | ||
middyBeeline({ | ||
writeKey: 'key', | ||
serviceName: 'myService', | ||
dataset: 'myDataset', | ||
}), | ||
); | ||
|
||
const event = { | ||
requestContext: {}, | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
}; | ||
handler(event, null, (err) => { | ||
expect(err).toBe(null); | ||
done(); | ||
}); | ||
const request = { event }; | ||
middleware.before(request); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters