Skip to content

Commit 72c8079

Browse files
0xAlunara0xAlunara
authored andcommitted
test: wip
1 parent 13a82c0 commit 72c8079

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import { useEffect, useMemo } from 'react'
2+
import { LoanManageSoftLiquidation } from '@/loan/components/PageLoanManage/LoanManageSoftLiquidation'
3+
import networks from '@/loan/networks'
4+
import useStore from '@/loan/store/useStore'
5+
import { ClientWrapper } from '@cy/support/helpers/ClientWrapper'
6+
import { createTestWagmiConfigFromVNet, forkVirtualTestnet } from '@cy/support/helpers/tenderly'
7+
import Skeleton from '@mui/material/Skeleton'
8+
import { ConnectionProvider, useConnection } from '@ui-kit/features/connect-wallet'
9+
import { Chain } from '@ui-kit/utils'
10+
11+
describe('Manage soft liquidation', () => {
12+
const privateKey = '0xc9dc976b6701eb9d79c8358317c565cfc6d238a6ecbb0839b352d4f5d71953c9' // 0xDD84Be02F834295ebE3328e0fE03C015492e2A51
13+
const network = networks[Chain.Ethereum]
14+
const MARKET_ID = 'wsteth' // https://www.curve.finance/crvusd/ethereum/markets/wstETH/create
15+
16+
const getVirtualNetwork = forkVirtualTestnet((uuid) => ({
17+
vnet_id: 'a967f212-c4a3-4d65-afb6-2e79055f7a6f',
18+
display_name: `crvUSD wstETH Soft Liquidation Fork ${uuid}`,
19+
}))
20+
21+
const TestComponent = () => {
22+
const { llamaApi } = useConnection()
23+
const market = useMemo(() => llamaApi?.getMintMarket(MARKET_ID), [llamaApi])
24+
const fetchLoanDetails = useStore((state) => state.loans.fetchLoanDetails)
25+
const fetchUserLoanDetails = useStore((state) => state.loans.fetchUserLoanDetails)
26+
27+
useEffect(() => {
28+
if (llamaApi && market) {
29+
void fetchLoanDetails(llamaApi, market)
30+
void fetchUserLoanDetails(llamaApi, market)
31+
}
32+
}, [fetchLoanDetails, fetchUserLoanDetails, llamaApi, market])
33+
34+
return market ? <LoanManageSoftLiquidation marketId={MARKET_ID} /> : <Skeleton />
35+
}
36+
37+
const TestComponentWrapper = () => (
38+
<ClientWrapper config={createTestWagmiConfigFromVNet({ vnet: getVirtualNetwork(), privateKey })} autoConnect>
39+
<ConnectionProvider app="llamalend" network={network} onChainUnavailable={console.error}>
40+
<TestComponent />
41+
</ConnectionProvider>
42+
</ClientWrapper>
43+
)
44+
45+
describe('loan', () => {
46+
it(`manual test`, () => {
47+
cy.mount(<TestComponentWrapper />)
48+
cy.pause()
49+
})
50+
})
51+
})

0 commit comments

Comments
 (0)