Skip to content

Commit 4b46f5b

Browse files
committed
test(sdk): more signaturescreen tests
1 parent 79987db commit 4b46f5b

File tree

3 files changed

+290
-292
lines changed

3 files changed

+290
-292
lines changed

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { TEST_CLIENT } from "../../../../../../test/src/test-clients.js";
66
import { createWallet } from "../../../../../wallets/create-wallet.js";
77
import type { ConnectLocale } from "../locale/types.js";
88
import { SignatureScreen } from "./SignatureScreen.js";
9+
import { useActiveWallet } from "../../../../core/hooks/wallets/useActiveWallet.js";
910

1011
const mockAuth = vi.hoisted(() => ({
1112
doLogin: vi.fn().mockResolvedValue(undefined),
@@ -14,14 +15,12 @@ const mockAuth = vi.hoisted(() => ({
1415
isLoggedIn: vi.fn().mockResolvedValue(true),
1516
}));
1617

17-
const wallet = createWallet("io.metamask");
18-
1918
vi.mock("../../../../core/hooks/auth/useSiweAuth", () => ({
2019
useSiweAuth: () => mockAuth,
2120
}));
2221

2322
vi.mock("../../../../core/hooks/wallets/useActiveWallet", () => ({
24-
useActiveWallet: () => wallet,
23+
useActiveWallet: vi.fn().mockReturnValue(createWallet("io.metamask")),
2524
}));
2625

2726
vi.mock("../../../../core/hooks/wallets/useActiveAccount", () => ({
@@ -102,10 +101,9 @@ describe("SignatureScreen", () => {
102101
});
103102

104103
it("shows loading state when wallet is undefined", async () => {
105-
// Override the mock to return undefined for this test
106104
vi.mocked(useActiveWallet).mockReturnValueOnce(undefined);
107105

108-
const { getByTestId } = render(
106+
const { queryByTestId } = render(
109107
<SignatureScreen
110108
onDone={() => {}}
111109
modalSize="wide"
@@ -116,7 +114,7 @@ describe("SignatureScreen", () => {
116114
{ setConnectedWallet: true },
117115
);
118116

119-
expect(getByTestId("loading-screen")).toBeInTheDocument();
117+
expect(queryByTestId("sign-in-button")).not.toBeInTheDocument();
120118
});
121119

122120
it("handles error state", async () => {

0 commit comments

Comments
 (0)