Skip to content

Commit

Permalink
feat: Add tests for resource variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Danilo Campana Fuchs committed Jun 3, 2020
1 parent 5ff81fb commit cdfdd92
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/integration/handler/handler.js
Expand Up @@ -202,3 +202,10 @@ exports.TestPathVariable = (event, context, callback) => {
body: stringify(event.path),
})
}

exports.TestResourceVariable = (event, context, callback) => {
callback(null, {
statusCode: 200,
body: stringify(event.resource),
})
}
7 changes: 7 additions & 0 deletions tests/integration/handler/handlerPayload.test.js
Expand Up @@ -301,6 +301,13 @@ describe('handler payload tests with prepend off', () => {
path: '/test-path-variable-handler',
status: 200,
},

{
description: 'test resource variable',
expected: '/{id}/test-resource-variable-handler',
path: '/1/test-resource-variable-handler',
status: 200,
},
].forEach(({ description, expected, path, status }) => {
test(description, async () => {
const url = joinUrl(TEST_BASE_URL, path)
Expand Down
7 changes: 7 additions & 0 deletions tests/integration/handler/serverless.yml
Expand Up @@ -155,3 +155,10 @@ functions:
method: get
path: test-path-variable-handler
handler: handler.TestPathVariable

TestResourceVariable:
events:
- http:
method: get
path: /{id}/test-resource-variable-handler
handler: handler.TestResourceVariable

0 comments on commit cdfdd92

Please sign in to comment.