Skip to content
This repository has been archived by the owner on Jun 15, 2024. It is now read-only.

Commit

Permalink
test(walletconnect): add unit tests for WalletConnect
Browse files Browse the repository at this point in the history
  • Loading branch information
drichar committed Dec 13, 2023
1 parent ded26de commit 1befeec
Show file tree
Hide file tree
Showing 5 changed files with 694 additions and 22 deletions.
9 changes: 4 additions & 5 deletions __tests__/wallets/supported/defly.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@ const localStorageMock = (() => {
clear: () => (store = {})
}
})()
if (typeof global.localStorage === 'undefined') {
Object.defineProperty(global, 'localStorage', {
value: localStorageMock
})
}
Object.defineProperty(global, 'localStorage', {
value: localStorageMock
})

describe('DeflyWallet', () => {
let wallet: DeflyWallet
Expand Down Expand Up @@ -116,6 +114,7 @@ describe('DeflyWallet', () => {
// Connect first to initialize client
await wallet.connect()
expect(wallet.isConnected).toBe(true)
expect(store.getState().wallets.get(WalletId.DEFLY)).toBeDefined()

await wallet.disconnect()
expect(wallet.isConnected).toBe(false)
Expand Down
1 change: 1 addition & 0 deletions __tests__/wallets/supported/exodus.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ describe('ExodusWallet', () => {
// Connect first to initialize client
await wallet.connect()
expect(wallet.isConnected).toBe(true)
expect(store.getState().wallets.get(WalletId.EXODUS)).toBeDefined()

await wallet.disconnect()
expect(wallet.isConnected).toBe(false)
Expand Down
9 changes: 4 additions & 5 deletions __tests__/wallets/supported/pera.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@ const localStorageMock = (() => {
clear: () => (store = {})
}
})()
if (typeof global.localStorage === 'undefined') {
Object.defineProperty(global, 'localStorage', {
value: localStorageMock
})
}
Object.defineProperty(global, 'localStorage', {
value: localStorageMock
})

describe('PeraWallet', () => {
let wallet: PeraWallet
Expand Down Expand Up @@ -116,6 +114,7 @@ describe('PeraWallet', () => {
// Connect first to initialize client
await wallet.connect()
expect(wallet.isConnected).toBe(true)
expect(store.getState().wallets.get(WalletId.PERA)).toBeDefined()

await wallet.disconnect()
expect(wallet.isConnected).toBe(false)
Expand Down
Loading

0 comments on commit 1befeec

Please sign in to comment.