Skip to content

Commit 1139130

Browse files
committed
Add Unit Test
1 parent 4488377 commit 1139130

File tree

5 files changed

+4338
-1
lines changed

5 files changed

+4338
-1
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
samconfig.toml
1+
samconfig.toml
2+
3+
node_modules

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
Demo app for [Cloud Coffee Break](https://github.com/symphoniacloud/cloud-coffee-break).
44

5+
## Running Unit tests
6+
7+
```
8+
% npm install
9+
% npm test
10+
```
11+
512
## Creating, deploying, calling, and tearing-down
613

714
First, make sure you have the prerequisites setup, as described [in the notes for Episode 1](https://github.com/symphoniacloud/cloud-coffee-break/blob/main/episode1/README.md).

__tests__/unit/api.test.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
const lambda = require('../../src/api.js');
2+
3+
describe('Test Web API handler', () => {
4+
it('should return expected message', async () => {
5+
const result = await lambda.handler({});
6+
7+
const expectedResult = {
8+
statusCode: 200,
9+
body : "Hello World Episode 2!"
10+
};
11+
12+
expect(result).toEqual(expectedResult);
13+
});
14+
});

0 commit comments

Comments
 (0)