Skip to content

Commit

Permalink
test: test add new test visualizarMetrica data Co-authored-by: Gustav…
Browse files Browse the repository at this point in the history
…o Souza <[email protected]>
  • Loading branch information
Jkluiza committed Sep 20, 2024
1 parent 845ca26 commit f5e077d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/app/__tests__/visualizarMetrica.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,19 @@ describe("VisualizarMetrica component", () => {
});
});

it('deve retornar null se a chave não existir no AsyncStorage', async () => {
// Mock da implementação de AsyncStorage.getItem para retornar null
(AsyncStorage.getItem as jest.Mock).mockImplementation(() => {
return Promise.resolve(null);
});

const key = 'chave_inexistente';
const value = await AsyncStorage.getItem(key);

// Verifique se o valor retornado é null
expect(value).toBeNull();
});

test("renders the component correctly", async () => {
const { getByText } = render(<VisualizarMetrica />);

Expand Down

0 comments on commit f5e077d

Please sign in to comment.