Skip to content

Commit

Permalink
fix: pool tests
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewlilley committed Mar 20, 2024
1 parent 885476b commit ebe1ebf
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 19 deletions.
10 changes: 5 additions & 5 deletions apps/evm/src/lib/wagmi/test/constants.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Chain, foundry, polygon } from 'viem/chains'
import { publicChains } from 'sushi/config'
import { foundry } from 'viem/chains'

export const foundryPolygon = {
...polygon,
export const testChains = publicChains.map((chain) => ({
...chain,
rpcUrls: foundry.rpcUrls,
} satisfies Chain
})) as unknown as typeof publicChains

export const testChains = [foundryPolygon] as const
export type TestChainId = (typeof testChains)[number]['id']

// Default accounts from Anvil
Expand Down
22 changes: 10 additions & 12 deletions apps/evm/src/lib/wagmi/test/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { mock } from '@wagmi/connectors'
import { http } from 'viem'
import { ChainId } from 'sushi'
import { http, HttpTransport } from 'viem'
import { privateKeyToAccount } from 'viem/accounts'

import { createConfig } from 'wagmi'

import { ChainId } from 'sushi'
import { accounts, testChains } from './constants'

const anvilPort = String(
Expand Down Expand Up @@ -33,15 +31,15 @@ export const createTestConfig = () => {
},
})

const chain = testChains.find((x) => x.id === chainId)!

return createConfig({
chains: [chain],
transports: {
[ChainId.ETHEREUM]: http(localHttpUrl),
[ChainId.POLYGON]: http(localHttpUrl),
[ChainId.ARBITRUM]: http(localHttpUrl),
},
chains: testChains,
transports: testChains.reduce(
(acc, chain) => {
acc[chain.id] = http(localHttpUrl)
return acc
},
{} as Record<ChainId, HttpTransport>,
),
pollingInterval: 1_000,
connectors: [mockConnector],
})
Expand Down
1 change: 0 additions & 1 deletion apps/evm/src/providers/wagmi-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export const WagmiConfig: FC<{ children: ReactNode }> = ({ children }) => {
if (isTest) {
return createTestConfig() as unknown as PublicWagmiConfig
}

return createProductionConfig()
}, [])

Expand Down
2 changes: 1 addition & 1 deletion apps/evm/test/pool/pool.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -424,8 +424,8 @@ async function createOrAddV2Pool(
}

async function removeLiquidityV3(page: Page, _next: NextFixture) {
await connect(page)
await page.goto(BASE_URL)
await connect(page)
await page.locator('[testdata-id=my-positions-button]').click()

const concentratedPositionTableSelector = page.locator(
Expand Down
2 changes: 2 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ebe1ebf

Please sign in to comment.