Skip to content

Commit

Permalink
Add tests for #758, #759
Browse files Browse the repository at this point in the history
  • Loading branch information
dnalborczyk committed Aug 2, 2019
1 parent 0d77c92 commit b72d240
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/__tests__/integration/uncategorized/serverless.yml
Expand Up @@ -32,3 +32,20 @@ functions:
application/json;charset=UTF-8: ''
statusCode: 200
handler: uncategorized.uncategorizedHandler1

uncategorizedHandler2:
events:
- http:
integration: lambda
method: get
path: uncategorized-2
responses:
default:
responseModels:
application/json;charset=UTF-8: Empty
responseParameters:
method.response.header.x-foo: 'integration.response.body.more-foo.property-of-undefined'
responseTemplates:
application/json;charset=UTF-8: ''
statusCode: 200
handler: uncategorized.uncategorizedHandler2
6 changes: 6 additions & 0 deletions src/__tests__/integration/uncategorized/uncategorized.js
Expand Up @@ -5,3 +5,9 @@ module.exports.uncategorizedHandler1 = async () => {
foo: 'bar',
};
};

module.exports.uncategorizedHandler2 = async () => {
return {
foo: 'bar',
};
};
9 changes: 9 additions & 0 deletions src/__tests__/integration/uncategorized/uncategorized.test.js
Expand Up @@ -36,4 +36,13 @@ describe('handler payload tests', () => {
const json = await response.json();
expect(json).toEqual({ foo: 'bar' });
});

// issue: https://github.com/dherault/serverless-offline/issues/758
// PR: https://github.com/dherault/serverless-offline/pull/759
test('Uncategorized 2', async () => {
url.pathname = 'uncategorized-2';
const response = await fetch(url);
const json = await response.json();
expect(json).toEqual({ foo: 'bar' });
});
});

0 comments on commit b72d240

Please sign in to comment.