mirror of
https://github.com/kremalicious/blog.git
synced 2024-11-22 01:46:51 +01:00
update tests
This commit is contained in:
parent
cbbb81e391
commit
25ea9f0bfa
@ -22,7 +22,7 @@ export function Data({
|
|||||||
|
|
||||||
const networkName = chains.filter(
|
const networkName = chains.filter(
|
||||||
(chain) => chain.id === selectedToken?.chainId
|
(chain) => chain.id === selectedToken?.chainId
|
||||||
)[0].name
|
)?.[0]?.name
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<table className={styles.table} aria-disabled={isDisabled}>
|
<table className={styles.table} aria-disabled={isDisabled}>
|
||||||
|
@ -5,7 +5,8 @@ import { useFetchTokens } from './useFetchTokens'
|
|||||||
test('useFetchTokens does not fetch anything when no chain or address are present', async () => {
|
test('useFetchTokens does not fetch anything when no chain or address are present', async () => {
|
||||||
vi.mock('wagmi', () => ({
|
vi.mock('wagmi', () => ({
|
||||||
useChainId: () => undefined,
|
useChainId: () => undefined,
|
||||||
useAccount: () => ({ address: undefined })
|
useAccount: () => ({ address: undefined }),
|
||||||
|
useChains: () => [{ id: 1, name: 'mainnet' }]
|
||||||
}))
|
}))
|
||||||
|
|
||||||
function TestComponent() {
|
function TestComponent() {
|
||||||
|
@ -35,6 +35,16 @@ export function useChainId() {
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function useChains() {
|
||||||
|
return [mainnet]
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useSwitchChain() {
|
||||||
|
return {
|
||||||
|
switchChain: vi.fn()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export function useAccount() {
|
export function useAccount() {
|
||||||
return {
|
return {
|
||||||
address: '0x0000000000000000000000000000000000000000',
|
address: '0x0000000000000000000000000000000000000000',
|
||||||
|
Loading…
Reference in New Issue
Block a user