From d7a7ed0464e28f4c981445a146cfae8a24971f60 Mon Sep 17 00:00:00 2001 From: yeojunjie <54196980+yeojunjie@users.noreply.github.com> Date: Wed, 28 Feb 2024 18:07:34 +0800 Subject: [PATCH 1/2] Fix test for summary display --- src/__tests__/pokemon-list.test.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/__tests__/pokemon-list.test.jsx b/src/__tests__/pokemon-list.test.jsx index 0f3cd22..f749c91 100644 --- a/src/__tests__/pokemon-list.test.jsx +++ b/src/__tests__/pokemon-list.test.jsx @@ -125,7 +125,7 @@ describe("Pokemon list with 'Load more' button", () => { // Check that the summary correctly updated expect( - await screen.findByText("Displaying 12 of 12 results") + await screen.findByText(/Displaying 12 of 12 results/) ).toBeInTheDocument(); // Check that 12 items are displayed From 6280e2aab66c0c398be47046b1305cf4c47d43cf Mon Sep 17 00:00:00 2001 From: yeojunjie <54196980+yeojunjie@users.noreply.github.com> Date: Wed, 28 Feb 2024 18:09:20 +0800 Subject: [PATCH 2/2] FIx two tests for summary display --- src/__tests__/pokemon-list.test.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/__tests__/pokemon-list.test.jsx b/src/__tests__/pokemon-list.test.jsx index f749c91..bb14064 100644 --- a/src/__tests__/pokemon-list.test.jsx +++ b/src/__tests__/pokemon-list.test.jsx @@ -73,7 +73,7 @@ describe("Pokemon list with 'Load more' button", () => { // Check that the summary correctly says how many items are shown expect( await screen.findByText( - `Displaying 5 of ${pokemonsResultPage1.count} results` + new RegExp(`Displaying 5 of ${pokemonsResultPage1.count} results`, 's') ) ).toBeInTheDocument(); }); @@ -89,7 +89,7 @@ describe("Pokemon list with 'Load more' button", () => { // Check that the summary correctly updated expect( await screen.findByText( - `Displaying 10 of ${pokemonsResultPage1.count} results` + new RegExp(`Displaying 10 of ${pokemonsResultPage1.count} results`, 's') ) ).toBeInTheDocument();