From 3418a7b2e6c1d7443e9275e2ceb1f3d8dc8a17fc Mon Sep 17 00:00:00 2001 From: Gabriel Date: Thu, 19 Sep 2024 16:37:59 -0300 Subject: [PATCH] test: new value when categoria is different Co-Authored-By: Natalia Rodrigues --- src/app/__tests__/visualizarMetrica.spec.tsx | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/app/__tests__/visualizarMetrica.spec.tsx b/src/app/__tests__/visualizarMetrica.spec.tsx index e8083dd1..95b8202b 100644 --- a/src/app/__tests__/visualizarMetrica.spec.tsx +++ b/src/app/__tests__/visualizarMetrica.spec.tsx @@ -130,3 +130,22 @@ test("closes the modal when 'Cancelar' is pressed", async () => { }); +test("does not show 'Novo valor' button when categoria is different", async () => { + jest.mock("expo-router", () => ({ + router: { + push: jest.fn(), + replace: jest.fn(), + }, + useLocalSearchParams: jest.fn(() => ({ + id: '123', + categoria: 'OUTRA_CATEGORIA', + })), + })); + + const { queryByText } = render(); + + await waitFor(() => { + const addButton = queryByText("Novo valor"); + expect(addButton).toBeNull(); +  }); +}); \ No newline at end of file