Skip to content

Commit fedc0be

Browse files
committed
test: add test for rendering unlink button
1 parent 235cd04 commit fedc0be

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

packages/thirdweb/src/react/web/ui/ConnectWallet/screens/LinkedProfilesScreen.test.tsx

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,5 +131,30 @@ describe("LinkedProfilesScreen", () => {
131131
render(<LinkedProfilesScreen {...mockProps} />);
132132
expect(screen.queryByText("Guest")).not.toBeInTheDocument();
133133
});
134+
135+
it("should render unlink button when there are multiple profiles", () => {
136+
vi.mocked(useProfiles).mockReturnValue({
137+
data: [
138+
{ type: "email", details: { email: "[email protected]" } },
139+
{ type: "google", details: { email: "[email protected]" } },
140+
],
141+
isLoading: false,
142+
// biome-ignore lint/suspicious/noExplicitAny: Mocking data
143+
} as any);
144+
145+
render(<LinkedProfilesScreen {...mockProps} />);
146+
expect(screen.getAllByLabelText("Unlink")).toHaveLength(2);
147+
});
148+
149+
it("should not render unlink button when there is only one profile", () => {
150+
vi.mocked(useProfiles).mockReturnValue({
151+
data: [{ type: "email", details: { email: "[email protected]" } }],
152+
isLoading: false,
153+
// biome-ignore lint/suspicious/noExplicitAny: Mocking data
154+
} as any);
155+
156+
render(<LinkedProfilesScreen {...mockProps} />);
157+
expect(screen.queryByLabelText("Unlink")).not.toBeInTheDocument();
158+
});
134159
});
135160
});

0 commit comments

Comments
 (0)