-
Notifications
You must be signed in to change notification settings - Fork 671
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for SNS and DynamoDB event sources (#468)
- Loading branch information
Showing
25 changed files
with
2,104 additions
and
82 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const eventSources = require('../src/event-sources') | ||
const testUtils = require('./utils') | ||
|
||
const dynamodbEventSource = eventSources.getEventSource({ | ||
eventSourceName: 'AWS_DYNAMODB' | ||
}) | ||
|
||
test('request is correct', () => { | ||
const req = getReq() | ||
expect(typeof req).toEqual('object') | ||
expect(req.headers).toEqual({ host: 'dynamodb.amazonaws.com' }) | ||
expect(req.body).toEqual(testUtils.dynamoDbEvent) | ||
expect(req.method).toEqual('POST') | ||
}) | ||
|
||
function getReq () { | ||
const event = testUtils.dynamoDbEvent | ||
const request = dynamodbEventSource.getRequest({ event }) | ||
return 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
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const eventSources = require('../src/event-sources') | ||
const testUtils = require('./utils') | ||
|
||
const snsEventSource = eventSources.getEventSource({ | ||
eventSourceName: 'AWS_SNS' | ||
}) | ||
|
||
test('request is correct', () => { | ||
const req = getReq() | ||
expect(typeof req).toEqual('object') | ||
expect(req.headers).toEqual({ host: 'sns.amazonaws.com' }) | ||
expect(req.body).toEqual(testUtils.snsEvent) | ||
expect(req.method).toEqual('POST') | ||
}) | ||
|
||
function getReq () { | ||
const event = testUtils.snsEvent | ||
const request = snsEventSource.getRequest({ event }) | ||
return request | ||
} |
Oops, something went wrong.