diff --git a/__tests__/react-typed.test.tsx b/__tests__/react-typed.test.tsx index 3b6d528..25c7908 100644 --- a/__tests__/react-typed.test.tsx +++ b/__tests__/react-typed.test.tsx @@ -3,30 +3,24 @@ import { render, screen } from "@testing-library/react"; import { ReactTyped } from "../src"; describe("", () => { - it("Renders correct", () => { - render( - - ); - expect(screen.getByTestId("react-typed")).toBeTruthy(); + it("Renders correct", async () => { + const textToType = "Here you can find anything"; + render(); + await new Promise((resolve) => setTimeout(resolve, 100)); + expect(screen.getByText(textToType)).toBeTruthy(); }); - it("Renders correct with children", () => { + it("Renders correct with children", async () => { + const textToType = "Search for products"; render( - + ); - expect(screen.getByTestId("react-typed")).toBeTruthy(); - expect(screen.getByTestId("typed-input")).toBeTruthy(); + await new Promise((resolve) => setTimeout(resolve, 100)); + + expect( + screen.getByTestId("typed-input").getAttribute("placeholder") + ).toEqual(textToType); }); it("Expect to update if props were change", () => { const typedInstance = jest.fn();