From 691f993f841704c1ed2104ac295e078fac436576 Mon Sep 17 00:00:00 2001 From: Mike Antoniadis Date: Wed, 7 Feb 2024 16:26:27 +0200 Subject: [PATCH] chore: fix tests --- __tests__/react-typed.test.tsx | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) 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();