You are on page 1of 4

Exercise

Complex Tests
#1 Add Multiple Books
Write a test that will allow you to add books to
the backend and the changes will be
Challenge reflected on the front-end. Your testing
should use pivoting and anchoring.

1. Start with 3 records.


2. Adding a book takes you to 4 records –
check that each book is adequately
mapped.
3. Connect up the view to reflect the
changes in your architecture.
#2
Delete Books
Add the ability to delete each book by id
presenter.deleteBook(bookId)

You need to test 2 different scenarios :


Power-up • A book can be deleted from the initial added
recordset (the 3 books).
• A book can be deleted after one has been added
by the user.
• When the test is finished update the react
component with the new markup.

Delete Book Url


https://api.logicroom.co/api/<your email>/books/<bookId>
#3
Lesson Start
https://codesandbox.io/s/bftdd-lesson-41-pw505

1. Visit the link above and remember to open a codesandbox.io


account to save progress
2. Work on the starter project and complete the challenge
3. The solution is provided below but not the power-up!

Resources
Backend Test API

GET https://api.logicroom.co/api/<your email>/books (list)

POST https://api.logicroom.co/api/<your email>/books (add)


"Content-Type": "application/json"
{
"name": "x_name",
"author": "x_author"
}

DELETE https://api.logicroom.co/api/<your email>/books/<bookId>

Backend Test API reset


https://api.logicroom.co/api/<your email>/reset

Solution Template
https://codesandbox.io/s/bftdd-lesson-42-du2ho

You might also like