Skip to content

Commit

Permalink
fix test types
Browse files Browse the repository at this point in the history
  • Loading branch information
JFrankfurt committed Aug 1, 2023
1 parent 8076f78 commit 894dfc9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/walletconnect-v2/src/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ class MockWalletConnectProvider extends MockEIP1193Provider<number> {

constructor(opts: EthereumProviderOptions) {
super()
this.chainId = opts.chains[0]
if (opts.chains && opts.chains.length > 0) {
this.chainId = opts.chains[0]
} else if (opts.optionalChains && opts.optionalChains.length > 0) {
this.chainId = opts.optionalChains[0]
}
this.opts = opts
}

Expand Down Expand Up @@ -68,7 +72,7 @@ class MockWalletConnectProvider extends MockEIP1193Provider<number> {
* We mock this method later in the test suite to test behavior when optional chains are not supported.
*/
public getConnectedChains() {
return this.opts.chains.concat(this.opts.optionalChains || [])
return (this.opts.chains || []).concat(this.opts.optionalChains || [])
}

// session is an object when connected, undefined otherwise
Expand Down

0 comments on commit 894dfc9

Please sign in to comment.