Skip to content

Commit

Permalink
fix: update BookList test to support new response
Browse files Browse the repository at this point in the history
  • Loading branch information
amalv committed Dec 21, 2023
1 parent 49c014d commit 3b716ff
Showing 1 changed file with 39 additions and 34 deletions.
73 changes: 39 additions & 34 deletions src/components/BookList/BookList.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,45 @@ const mocks = [
{
request: {
query: BOOKS_QUERY,
variables: { title: "" },
variables: { title: "", limit: 50 },
},
result: {
data: {
books: [
{
id: "1",
title: "1984",
author: "George Orwell",
publicationDate: "1949-06-08",
image: null,
rating: 85,
ratingsCount: 123,
__typename: "Book",
},
{
id: "2",
title: "The Great Gatsby",
author: "F. Scott Fitzgerald",
publicationDate: "1925-04-10",
image: null,
rating: 88,
ratingsCount: 200,
__typename: "Book",
},
{
id: "3",
title: "To Kill a Mockingbird",
author: "Harper Lee",
publicationDate: "1960-07-11",
image: null,
rating: 90,
ratingsCount: 250,
__typename: "Book",
},
],
books: {
cursor: "3",
books: [
{
id: "1",
title: "1984",
author: "George Orwell",
publicationDate: "1949-06-08",
image: null,
rating: 85,
ratingsCount: 123,
__typename: "Book",
},
{
id: "2",
title: "The Great Gatsby",
author: "F. Scott Fitzgerald",
publicationDate: "1925-04-10",
image: null,
rating: 88,
ratingsCount: 200,
__typename: "Book",
},
{
id: "3",
title: "To Kill a Mockingbird",
author: "Harper Lee",
publicationDate: "1960-07-11",
image: null,
rating: 90,
ratingsCount: 250,
__typename: "Book",
},
],
},
},
},
},
Expand All @@ -57,7 +60,9 @@ describe("BookList", () => {
</MockedProvider>
);

const expectedTitles = mocks[0].result.data.books.map((book) => book.title);
const expectedTitles = mocks[0].result.data.books.books.map(
(book) => book.title
);

for (const title of expectedTitles) {
await waitFor(() => {
Expand Down

0 comments on commit 3b716ff

Please sign in to comment.