|
| 1 | +import { jest, test } from "@jest/globals"; |
| 2 | +import { screen } from "@testing-library/react-native"; |
| 3 | +import React from "react"; |
| 4 | +import { measureRenders } from "reassure"; |
| 5 | + |
| 6 | +import Avatar from "../Avatar"; |
| 7 | + |
| 8 | +jest.setTimeout(600_000); |
| 9 | + |
| 10 | +const TestComponent = ({ uri }: { uri?: string }) => <Avatar uri={uri} />; |
| 11 | + |
| 12 | +test("Empty Avatar 10 runs", async () => { |
| 13 | + const scenario = async () => { |
| 14 | + await screen.findByTestId("avatar-placeholder"); |
| 15 | + }; |
| 16 | + |
| 17 | + await measureRenders(<TestComponent />, { scenario, runs: 10 }); |
| 18 | +}); |
| 19 | + |
| 20 | +test("Empty Avatar 50 runs", async () => { |
| 21 | + const scenario = async () => { |
| 22 | + await screen.findByTestId("avatar-placeholder"); |
| 23 | + }; |
| 24 | + |
| 25 | + await measureRenders(<TestComponent />, { scenario, runs: 50 }); |
| 26 | +}); |
| 27 | + |
| 28 | +test("Avatar Image 10 runs", async () => { |
| 29 | + const scenario = async () => { |
| 30 | + await screen.findByTestId("avatar-image"); |
| 31 | + }; |
| 32 | + |
| 33 | + await measureRenders(<TestComponent uri="https://picsum.photos/200/300" />, { |
| 34 | + scenario, |
| 35 | + runs: 10, |
| 36 | + }); |
| 37 | +}); |
| 38 | + |
| 39 | +test("Avatar Image 50 runs", async () => { |
| 40 | + const scenario = async () => { |
| 41 | + await screen.findByTestId("avatar-image"); |
| 42 | + }; |
| 43 | + |
| 44 | + await measureRenders(<TestComponent uri="https://picsum.photos/200/300" />, { |
| 45 | + scenario, |
| 46 | + runs: 50, |
| 47 | + }); |
| 48 | +}); |
0 commit comments