1
0
Fork 0

update tests

This commit is contained in:
Matthias Kretschmann 2024-03-14 13:29:08 +00:00
parent cbbb81e391
commit 25ea9f0bfa
Signed by: m
GPG Key ID: 606EEEF3C479A91F
3 changed files with 13 additions and 2 deletions

View File

@ -22,7 +22,7 @@ export function Data({
const networkName = chains.filter(
(chain) => chain.id === selectedToken?.chainId
)[0].name
)?.[0]?.name
return (
<table className={styles.table} aria-disabled={isDisabled}>

View File

@ -5,7 +5,8 @@ import { useFetchTokens } from './useFetchTokens'
test('useFetchTokens does not fetch anything when no chain or address are present', async () => {
vi.mock('wagmi', () => ({
useChainId: () => undefined,
useAccount: () => ({ address: undefined })
useAccount: () => ({ address: undefined }),
useChains: () => [{ id: 1, name: 'mainnet' }]
}))
function TestComponent() {

View File

@ -35,6 +35,16 @@ export function useChainId() {
return 1
}
export function useChains() {
return [mainnet]
}
export function useSwitchChain() {
return {
switchChain: vi.fn()
}
}
export function useAccount() {
return {
address: '0x0000000000000000000000000000000000000000',