Skip to content

Commit

Permalink
chore: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
enesozturk committed Nov 25, 2024
1 parent cb0728e commit df418e9
Showing 1 changed file with 38 additions and 1 deletion.
39 changes: 38 additions & 1 deletion packages/adapters/wagmi/src/tests/client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ import {
getEnsAddress as wagmiGetEnsAddress,
writeContract as wagmiWriteContract,
waitForTransactionReceipt,
getAccount
getAccount,
createConfig
} from '@wagmi/core'
import { mainnet } from '@wagmi/core/chains'
import { CaipNetworksUtil } from '@reown/appkit-utils'
import type UniversalProvider from '@walletconnect/universal-provider'
import type { HttpTransport } from 'viem'

vi.mock('@wagmi/core', async () => {
const actual = await vi.importActual('@wagmi/core')
Expand Down Expand Up @@ -108,6 +110,41 @@ describe('WagmiAdapter', () => {

expect(injectedConnector?.info).toBeUndefined()
})

it('should pass WagmiAdapter constructor params to createConfig', () => {
new WagmiAdapter({
networks: mockNetworks,
projectId: mockProjectId,
ssr: true
})

expect(vi.mocked(createConfig)).toHaveBeenCalledWith(
expect.objectContaining({
chains: expect.any(Array),
projectId: mockProjectId,
ssr: true
})
)
})

it('should merge provided transports with default network transports', () => {
const mockCustomTransport = {} as HttpTransport
const mockTransports = { 1: mockCustomTransport }

new WagmiAdapter({
networks: mockNetworks,
projectId: mockProjectId,
transports: mockTransports
})

expect(vi.mocked(createConfig)).toHaveBeenCalledWith(
expect.objectContaining({
transports: expect.objectContaining({
1: mockCustomTransport
})
})
)
})
})

describe('WagmiAdapter - signMessage', () => {
Expand Down

0 comments on commit df418e9

Please sign in to comment.