From 439052f0a871a4f32b7401c7b5721d0edad12bb6 Mon Sep 17 00:00:00 2001 From: Gabriel Date: Thu, 19 Sep 2024 20:36:23 -0300 Subject: [PATCH 1/2] test: search with debounce --- src/app/__tests__/forum.spec.tsx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/app/__tests__/forum.spec.tsx b/src/app/__tests__/forum.spec.tsx index e87292b0..a3c6f354 100644 --- a/src/app/__tests__/forum.spec.tsx +++ b/src/app/__tests__/forum.spec.tsx @@ -66,4 +66,21 @@ describe("Forum", () => { })); }); + it("deve realizar pesquisa com debounce", async () => { + const { getByPlaceholderText } = render(); + + // Alterar para o placeholder correto + const searchInput = getByPlaceholderText("Pesquise uma publicação"); + + fireEvent.changeText(searchInput, ""); + + // Aguarda o debounce + await waitFor(() => { + expect(getAllPublicacao).toHaveBeenCalledWith( + 0, + { titulo: "", isReported: false }, + expect.any(Object) + ); + }); + }); }); From c8e1fcc5968640064ec76d1e2f94ccff1028be79 Mon Sep 17 00:00:00 2001 From: Sebastian Zuzunaga Date: Thu, 19 Sep 2024 19:07:51 -0500 Subject: [PATCH 2/2] test: add test for layout --- reports/sonar-report.xml | 464 ++++++++++++++++++++- src/app/__tests__/_layout.spec.tsx | 5 + src/app/__tests__/reports/sonar-report.xml | 7 +- 3 files changed, 468 insertions(+), 8 deletions(-) diff --git a/reports/sonar-report.xml b/reports/sonar-report.xml index b5819e79..486e2a57 100644 --- a/reports/sonar-report.xml +++ b/reports/sonar-report.xml @@ -1,10 +1,464 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/app/__tests__/_layout.spec.tsx b/src/app/__tests__/_layout.spec.tsx index 20781f7d..50d06659 100644 --- a/src/app/__tests__/_layout.spec.tsx +++ b/src/app/__tests__/_layout.spec.tsx @@ -56,4 +56,9 @@ describe("TabsLayout", () => { expect(getByTestId('tabs-mock')).toBeTruthy(); }); */ + it("deve configurar os listeners de notificação", () => { + render(); + expect(Notifications.addNotificationReceivedListener).toHaveBeenCalled(); + expect(Notifications.addNotificationResponseReceivedListener).toHaveBeenCalled(); + }); }); diff --git a/src/app/__tests__/reports/sonar-report.xml b/src/app/__tests__/reports/sonar-report.xml index 3f69a426..34c663b7 100644 --- a/src/app/__tests__/reports/sonar-report.xml +++ b/src/app/__tests__/reports/sonar-report.xml @@ -1,6 +1,7 @@ - - - + + + + \ No newline at end of file