Skip to content

Commit 9252afb

Browse files
committed
add new test for positionCreate with ropsten
1 parent 3ea8066 commit 9252afb

1 file changed

Lines changed: 27 additions & 31 deletions

File tree

Lines changed: 27 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,44 @@
1-
import { ethers } from 'ethers'
2-
// import { createLockupContract, LockupContract } from '../../ethereum/lockup'
3-
// import { createGetValueCaller } from '../../ethereum/lockup/getValue'
4-
// import { lockupAbi } from '../../ethereum/lockup/abi'
5-
// import { createGetPropertyValueCaller } from '../../ethereum/lockup/getPropertyValue'
6-
// import { createWithdrawCaller } from '../../ethereum/lockup/withdraw'
7-
// import { createCalculateWithdrawableInterestAmountCaller } from '../../ethereum/lockup/calculateWithdrawableInterestAmount'
8-
// import { createGetAllValueCaller } from '../../ethereum/lockup/getAllValue'
9-
// import { createGetStorageWithdrawalStatusCaller } from '../../ethereum/lockup/getStorageWithdrawalStatus'
10-
// import { createCalculateCumulativeHoldersRewardAmountCaller } from '../../ethereum/lockup/calculateCumulativeHoldersRewardAmount'
11-
// import { createCalculateCumulativeRewardPricesCaller } from '../../ethereum/lockup/calculateCumulativeRewardPrices'
12-
// import { createCalculateRewardAmountCaller } from '../../ethereum/lockup/calculateRewardAmount'
13-
// import { createCapCaller } from '../../ethereum/lockup/cap'
14-
// import { createDepositToPropertyCaller } from '../../ethereum/lockup/depositToProperty'
15-
// import { createDepositToPositionCaller } from '../../ethereum/lockup/depositToPosition'
16-
// import { createWithdrawByPositionCaller } from '../../ethereum/lockup/withdrawByPosition'
17-
// import { createMigrateToSTokensCaller } from '../../ethereum/lockup/migrateToSTokens'
18-
// import { createcalculateWithdrawableInterestAmountByPositionCaller } from '../../ethereum/lockup/calculateWithdrawableInterestAmountByPosition'
19-
import { stubTransactionResposeFactory } from '../../common/utils/for-test'
1+
import { ethers, Wallet } from 'ethers'
202
import { Options, positionsCreate } from './positionsCreate'
213
import { testProviders } from '../common/const'
4+
import { env } from '../common/env'
225

236
describe('positionsCreate.ts', () => {
24-
const host = 'localhost'
25-
const address = '0x0000000000000000000000000000000000000000'
26-
const provider = new ethers.providers.JsonRpcProvider(host)
27-
28-
const propertyAddress = '0x80a25ACDD0797dfCe02dA25e4a55A4a334EE51c5'
7+
const propertyAddress = '0x38c4bF6cD20d157EE45553b0fAD13B0c6750b439'
298
const amount = '100'
309
const overrides = {
3110
overrides: undefined,
3211
fallback: undefined,
3312
}
3413

35-
const stubTx = stubTransactionResposeFactory({})
36-
it('return Error if network is not valid', async () => {
37-
const options: Options = {
38-
provider: testProviders.polyMumbai,
14+
it("", async () => {
15+
// await window.ethereum.enable()
16+
const wallet = new ethers.Wallet(env.mnemonic, testProviders.ropsten)
17+
console.log(wallet)
18+
const options: Options = {
19+
wallet,
3920
propertyAddress,
4021
amount,
4122
overrides,
4223
}
43-
const result = async () => {
44-
await positionsCreate(options)
24+
const tx = await positionsCreate(options).then(result => result)
25+
console.log(tx)
26+
})
27+
it('return undefined if network is not valid', async () => {
28+
const wallet = new ethers.Wallet(env.mnemonic, testProviders.polyMumbai)
29+
const options: Options = {
30+
wallet,
31+
propertyAddress,
32+
amount,
33+
overrides,
4534
}
46-
expect(result).rejects.toThrow('network is not valid')
35+
const tx = await positionsCreate(options).then(result => result)
36+
expect(tx).toEqual(undefined)
4737
})
4838
})
39+
40+
// declare global {
41+
// interface Window {
42+
// ethereum: any;
43+
// }
44+
// }

0 commit comments

Comments
 (0)