Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

2. Write test suite stubs

- [ ] integration
- [x] [integration](https://github.com/mjgs/serverless-books-api/pull/20)
- [x] [unit](https://github.com/mjgs/serverless-books-api/pull/11)

3. Write books REST API using TDD
Expand Down
71 changes: 71 additions & 0 deletions serverless.test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
- name: hello endpoint
endpoint:
function: hello
response:
status: 200

- name: add book - good data
endpoint:
method: POST
path: /book/add
request:
body:
name: 'A book about something interesting'
releaseDate: 1591816375
authorName: 'John Smith'
response:
status: 201
body:
name: 'A book about something interesting'
releaseDate: 1591816375
authorName: 'John Smith'

- name: add book - empty body
endpoint:
method: POST
path: /book/add
request:
body:
response:
status: 400
body:
message: 'Invalid request body'

- name: add book - missing name
endpoint:
method: POST
path: /book/add
request:
body:
releaseDate: 1591816375
authorName: 'John Smith'
response:
status: 400
body:
message: 'Invalid request body'

- name: add book - missing releaseDate
endpoint:
method: POST
path: /book/add
request:
body:
name: 'A book about something interesting'
authorName: 'John Smith'
response:
status: 400
body:
message: 'Invalid request body'

- name: add book - missing authorName
endpoint:
method: POST
path: /book/add
request:
body:
name: 'A book about something interesting'
releaseDate: 1591816375
response:
status: 400
body:
message: 'Invalid request body'