© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2021
J. QiuTest-Driven Development with Reacthttps://doi.org/10.1007/978-1-4842-6972-5_6

6. Implementing the Book Detail View

Juntao Qiu1  
(1)
Burwood East, 3151, Victoria, Australia
 

For each book in the book list, we want to display its name as a hyperlink, so when a user clicks it, the browser will navigate to the detail page. The detail page will contain content specific to each book, including its title, cover image, description, reviews, and so on.

Acceptance Tests

We can describe this requirement as an acceptance test in our bookish.spec.js:
it('Goes to the detail page', () => {
  cy.visit('http://localhost:3000/');
  cy.get('div.book-item').contains('View Details').eq(0).click(); ...

Get Test-Driven Development with React: Apply Test-Driven Development in Your Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.