Skip to content

Commit d0a8d1a

Browse files
0xAlunara0xAlunara
authored andcommitted
test: wip
1 parent d5387da commit d0a8d1a

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
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, withVirtualTestnet } 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+
const getVirtualNetwork = withVirtualTestnet(() => ({
21+
vnetId: '20c51886-c741-4066-ba0f-91b390fa7fe0',
22+
}))
23+
24+
const TestComponent = () => {
25+
const { llamaApi } = useConnection()
26+
const market = useMemo(() => llamaApi?.getMintMarket(MARKET_ID), [llamaApi])
27+
const fetchLoanDetails = useStore((state) => state.loans.fetchLoanDetails)
28+
const fetchUserLoanDetails = useStore((state) => state.loans.fetchUserLoanDetails)
29+
30+
useEffect(() => {
31+
if (llamaApi && market) {
32+
void fetchLoanDetails(llamaApi, market)
33+
void fetchUserLoanDetails(llamaApi, market)
34+
}
35+
}, [fetchLoanDetails, fetchUserLoanDetails, llamaApi, market])
36+
37+
return market ? <LoanManageSoftLiquidation market={market} /> : <Skeleton />
38+
}
39+
40+
const TestComponentWrapper = () => (
41+
<ClientWrapper config={createTestWagmiConfigFromVNet({ vnet: getVirtualNetwork(), privateKey })} autoConnect>
42+
<ConnectionProvider app="llamalend" network={network} onChainUnavailable={console.error}>
43+
<TestComponent />
44+
</ConnectionProvider>
45+
</ClientWrapper>
46+
)
47+
48+
describe('loan', () => {
49+
it(`manual test`, () => {
50+
cy.mount(<TestComponentWrapper />)
51+
cy.pause()
52+
})
53+
})
54+
})

0 commit comments

Comments
 (0)