Skip to content

Commit

Permalink
test(cors): Add test for CORS headers
Browse files Browse the repository at this point in the history
  • Loading branch information
anishkny committed May 17, 2018
1 parent 94a3c09 commit 52dd007
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"scripts": {
"lint": "eslint src/ test/",
"test": "npm run lint && ./test-api-local.sh",
"test": "npm run lint && AWS_ACCESS_KEY_ID=foo AWS_SECRET_ACCESS_KEY=bar ./test-api-local.sh",
"start": "./start-server.sh",
"stop": "./stop-server.sh",
"deploy": "serverless deploy",
Expand Down
10 changes: 10 additions & 0 deletions test/test.Util.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,16 @@ describe('Util', async () => {
`Expected key not found: [${k}], ` +
`Actual: [${JSON.stringify(pong.data)}]`);
});

// Verify CORS headers
[
['access-control-allow-origin', '*'],
['access-control-allow-credentials', 'true'],
].forEach(pair => {
assert.equal(pong.headers[pair[0]], pair[1],
`Expected header not found: [${pair[0]}]=[${pair[1]}]`
);
});
});

});
Expand Down

0 comments on commit 52dd007

Please sign in to comment.