-
Notifications
You must be signed in to change notification settings - Fork 659
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added sqs as event source (#483)
Co-authored-by: brett-vendia <72168202+brett-vendia@users.noreply.github.com>
- Loading branch information
1 parent
fb3a934
commit 3f86b23
Showing
7 changed files
with
80 additions
and
6 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
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 sqsEventSource = eventSources.getEventSource({ | ||
eventSourceName: 'AWS_SQS' | ||
}) | ||
|
||
test('request is correct', () => { | ||
const req = getReq() | ||
expect(typeof req).toEqual('object') | ||
expect(req.headers).toEqual({ host: 'sqs.amazonaws.com' }) | ||
expect(req.body).toEqual(testUtils.sqsEvent) | ||
expect(req.method).toEqual('POST') | ||
}) | ||
|
||
function getReq () { | ||
const event = testUtils.sqsEvent | ||
const request = sqsEventSource.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
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,18 @@ | ||
const { emptyResponseMapper } = require('../utils') | ||
|
||
const getRequestValuesFromSns = ({ event }) => { | ||
const method = 'POST' | ||
const headers = { host: 'sqs.amazonaws.com' } | ||
const body = event | ||
|
||
return { | ||
method, | ||
headers, | ||
body | ||
} | ||
} | ||
|
||
module.exports = { | ||
getRequest: getRequestValuesFromSns, | ||
getResponse: emptyResponseMapper | ||
} |
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