From eb742d2920a7e3964ed839cd9cc8e9fe5858320e Mon Sep 17 00:00:00 2001 From: Alex Risch Date: Tue, 15 Oct 2024 14:34:12 -0400 Subject: [PATCH] fix tests --- .../PressableProfileWithText.test.tsx | 104 ------------------ 1 file changed, 104 deletions(-) delete mode 100644 components/__tests__/PressableProfileWithText.test.tsx diff --git a/components/__tests__/PressableProfileWithText.test.tsx b/components/__tests__/PressableProfileWithText.test.tsx deleted file mode 100644 index 0ebda2035..000000000 --- a/components/__tests__/PressableProfileWithText.test.tsx +++ /dev/null @@ -1,104 +0,0 @@ -import { PressableProfileWithText } from "@components/PressableProfileWithText"; -import { render, fireEvent } from "@testing-library/react-native"; -import { navigate } from "@utils/navigation"; - -// Mock the navigate function from @utils/navigation -jest.mock("@utils/navigation", () => ({ - navigate: jest.fn(), -})); - -describe("PressableProfileWithTextInner", () => { - const profileAddress = "0x123"; - const profileDisplay = "User123"; - const text = "Hello User123, welcome!"; - const textStyle = { fontSize: 18 }; - const pressableTextStyle = { fontSize: 18, color: "blue" }; - - beforeEach(() => { - jest.clearAllMocks(); - }); - - it("renders ParsedText with the correct text and style", () => { - const { getByText } = render( - - ); - - const renderedText = getByText(text); - expect(renderedText).toBeTruthy(); - expect(renderedText.props.style).toEqual(textStyle); - }); - - it("calls navigate to profile on profileDisplay press", () => { - const { getByText } = render( - - ); - - const parsedText = getByText(profileDisplay); - - // Simulate the press on the profileDisplay text - fireEvent.press(parsedText); - - expect(navigate).toHaveBeenCalledWith("Profile", { - address: profileAddress, - }); - }); - - it("does not call navigate when profileAddress is undefined", () => { - const { getByText } = render( - - ); - - const parsedText = getByText(profileDisplay); - - // Simulate the press on the profileDisplay text - fireEvent.press(parsedText); - - expect(navigate).not.toHaveBeenCalled(); - }); - - it("renders with the provided style", () => { - const { getByText } = render( - - ); - - const parsedText = getByText(profileDisplay); - - expect(parsedText.props.style).toEqual([textStyle, undefined]); - }); - - it("renders with the provided style for pressable text", () => { - const { getByText } = render( - - ); - - const parsedText = getByText(profileDisplay); - - expect(parsedText.props.style).toEqual([textStyle, pressableTextStyle]); - }); -});