|
1 |
| -const middleware = require('../src'); |
| 1 | +const middleware = require("../src"); |
2 | 2 |
|
3 |
| -it('eventbridge events are passed through', async() => { |
4 |
| - const payload = { |
5 |
| - 'version': '0', |
6 |
| - 'id': '03f6b260-9ee8-af5f-4a02-95ebf5fc0925', |
7 |
| - 'detail-type': 'ArtworkUpdate', |
8 |
| - 'source': 'some-other-system', |
9 |
| - 'account': '493638157050', |
10 |
| - 'time': '2020-11-10T10:36:28Z', |
11 |
| - 'region': 'eu-west-1', |
12 |
| - 'resources': [], |
13 |
| - 'detail': { |
14 |
| - 'id': 31329, |
15 |
| - 'action': 'create', |
16 |
| - } |
17 |
| - }; |
| 3 | +it("eventbridge events are passed through", async () => { |
| 4 | + const payload = { |
| 5 | + version: "0", |
| 6 | + id: "03f6b260-9ee8-af5f-4a02-95ebf5fc0925", |
| 7 | + "detail-type": "ArtworkUpdate", |
| 8 | + source: "some-other-system", |
| 9 | + account: "493638157050", |
| 10 | + time: "2020-11-10T10:36:28Z", |
| 11 | + region: "eu-west-1", |
| 12 | + resources: [], |
| 13 | + detail: { |
| 14 | + id: 31329, |
| 15 | + action: "create", |
| 16 | + }, |
| 17 | + }; |
18 | 18 |
|
19 |
| - const exampleApp = middleware(async(event) => { |
20 |
| - return event; |
21 |
| - }).register(() => ({})); |
| 19 | + const exampleApp = middleware(async (event) => { |
| 20 | + return event; |
| 21 | + }).register(() => ({})); |
22 | 22 |
|
23 |
| - expect(JSON.parse(JSON.stringify(await exampleApp(payload)))).toEqual({ |
24 |
| - body: JSON.stringify(payload), |
25 |
| - headers: { |
26 |
| - 'Content-Type': 'application/json; charset=utf-8', |
27 |
| - }, |
28 |
| - isBase64Encoded: false, |
29 |
| - statusCode: 200, |
30 |
| - }); |
| 23 | + expect(JSON.parse(JSON.stringify(await exampleApp(payload)))).toEqual({ |
| 24 | + body: JSON.stringify(payload), |
| 25 | + headers: { |
| 26 | + "Content-Type": "application/json; charset=utf-8", |
| 27 | + }, |
| 28 | + isBase64Encoded: false, |
| 29 | + statusCode: 200, |
| 30 | + }); |
31 | 31 | });
|
0 commit comments