Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
xlc committed Jun 21, 2024
1 parent 6fec034 commit a286cb0
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 253 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
},
"resolutions": {
"@polkadot/api": "^11.3.1",
"@polkadot/api-derive": "^11.3.1"
"@polkadot/api-derive": "^11.3.1",
"@polkadot/types": "^11.3.1"
},
"dependencies": {
"@acala-network/chopsticks": "^0.12.2",
Expand Down
23 changes: 12 additions & 11 deletions tests/acala/dex.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { afterAll, beforeEach, describe, it } from 'vitest'
import { afterEach, beforeEach, describe, it } from 'vitest'
import { sendTransaction, testingPairs } from '@acala-network/chopsticks-testing'

import { Network, createNetworks } from '../../networks'
import { acala, karura } from '../../networks/acala'
import { checkEvents } from '../../helpers'
import { createNetworks } from '../../networks'
import { query } from '../../helpers/api'

describe.each([
Expand All @@ -16,31 +16,32 @@ describe.each([
swapPair: [acala.ausd, acala.ldot],
},
] as const)(`$name dex`, async ({ name, swapPair }) => {
const { [name]: chain } = await createNetworks({ [name]: undefined })
const { alice } = testingPairs()

const head = chain.chain.head
let chain: Network

afterAll(async () => {
await chain.teardown()
beforeEach(async () => {
const { [name]: chain1 } = await createNetworks({ [name]: undefined })

chain = chain1
})

beforeEach(async () => {
await chain.chain.setHead(head)
afterEach(async () => {
await chain.teardown()
})

it.each([
{
name: 'swapWithExactSupply',
tx: chain.api.tx.dex.swapWithExactSupply(swapPair as any, 1e12, 0),
tx: () => chain.api.tx.dex.swapWithExactSupply(swapPair as any, 1e12, 0),
},
{
name: 'swapWithExactTarget',
tx: chain.api.tx.dex.swapWithExactTarget(swapPair as any, 1e12, 1e15),
tx: () => chain.api.tx.dex.swapWithExactTarget(swapPair as any, 1e12, 1e15),
},
] as const)('$name works', async ({ name, tx }) => {
const _name = name
const tx0 = await sendTransaction(tx.signAsync(alice))
const tx0 = await sendTransaction(tx().signAsync(alice))

await chain.chain.newBlock()

Expand Down
Loading

0 comments on commit a286cb0

Please sign in to comment.