Skip to content

Commit 544c7ff

Browse files
committed
more tests pls
1 parent 687a694 commit 544c7ff

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

packages/thirdweb/src/wallets/manager/connection-manager.test.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,23 @@ describe.runIf(process.env.TW_SECRET_KEY)("Connection Manager", () => {
8383
expect.any(Function),
8484
);
8585
});
86+
87+
it("should clear active wallet data on disconnect", async () => {
88+
const manager = createConnectionManager(storage);
89+
90+
await manager.handleConnection(wallet, { client });
91+
92+
// Simulate wallet disconnect
93+
manager.disconnectWallet(wallet);
94+
95+
expect(storage.removeItem).toHaveBeenCalledWith(
96+
"thirdweb:active-wallet-id",
97+
);
98+
expect(manager.activeAccountStore.getValue()).toBeUndefined();
99+
expect(manager.activeWalletChainStore.getValue()).toBeUndefined();
100+
expect(manager.activeWalletStore.getValue()).toBeUndefined();
101+
expect(manager.activeWalletConnectionStatusStore.getValue()).toBe(
102+
"disconnected",
103+
);
104+
});
86105
});

0 commit comments

Comments
 (0)