Skip to content

Commit

Permalink
test: disconnect button in connected address modal
Browse files Browse the repository at this point in the history
  • Loading branch information
Valazan committed Nov 22, 2023
1 parent 2898f57 commit 8af4130
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions packages/dapp-kit-ui/test/connect-button-with-modal.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { beforeEach, describe, expect, it } from 'vitest';
import { beforeEach, describe, expect, it, vi } from 'vitest';

import {
ConnectButton,
Expand Down Expand Up @@ -61,6 +61,7 @@ describe('connect-button-with-modal', () => {

// testing the connected address badge

// mock a connection to the wallet by setting the address
element.address = '0x00000';

const connectedAddressBadgeWithModal =
Expand All @@ -73,12 +74,19 @@ describe('connect-button-with-modal', () => {

expect(connectedAddressBadge).toBeDefined();

// open the connected address modal
connectedAddressBadge.shadowRoot?.querySelector('div')?.click();

const ConnectedAddressModal =
const connectedAddressModal =
(await elementQueries.getConnectedAddressModal()) as ConnectedAddressModal;

expect(ConnectedAddressModal).toBeDefined();
expect(ConnectedAddressModal.open).toBe(true);
expect(connectedAddressModal).toBeDefined();

// disconnect from the wallet by clicking the disconnect button
connectedAddressModal.shadowRoot?.querySelector('button')?.click();

await element.updateComplete;

expect(element.address).toBeUndefined();
});
});

0 comments on commit 8af4130

Please sign in to comment.