From 37486161254d3823c4a7832f2eb101d1dcd3cb46 Mon Sep 17 00:00:00 2001 From: Fabious Date: Mon, 6 Feb 2023 16:28:00 +0100 Subject: [PATCH] test: init test for atelier 2 --- src/__tests__/exercice-02.js | 13 +++++++++++++ src/features/book-list/BookList.js | 2 ++ 2 files changed, 15 insertions(+) create mode 100644 src/__tests__/exercice-02.js diff --git a/src/__tests__/exercice-02.js b/src/__tests__/exercice-02.js new file mode 100644 index 0000000..a3f45b2 --- /dev/null +++ b/src/__tests__/exercice-02.js @@ -0,0 +1,13 @@ +import React from "react"; +import { render, screen } from "@testing-library/react"; +import BookList from "../features/book-list/BookList"; + +it("shows a list of books", () => { + render(); + + expect(screen.getByText(/Corbin Ritchie/)).toBeInTheDocument(); + expect(screen.getByText(/Deonte Effertz/)).toBeInTheDocument(); + expect(screen.getByText(/Dr. Abel Gutmann IV/)).toBeInTheDocument(); + expect(screen.getByText(/Prof. Scotty Pfannerstill DVM/)).toBeInTheDocument(); + expect(screen.getByText(/Ms. Alana Murphy/)).toBeInTheDocument(); +}); diff --git a/src/features/book-list/BookList.js b/src/features/book-list/BookList.js index 0dba136..a688b3f 100644 --- a/src/features/book-list/BookList.js +++ b/src/features/book-list/BookList.js @@ -1,3 +1,5 @@ +import React from 'react' + const books = [ {isbn: '9793083416011', title: 'Excepturi explicabo volu…am aut voluptate velit.', author: 'Corbin Ritchie'}, {isbn: '9786451149666', title: 'Est est et eveniet porro non.', author: 'Deonte Effertz'},