Skip to content

Commit

Permalink
fix aggregated dex (#195)
Browse files Browse the repository at this point in the history
* fix aggregated dex

* update test

* update snapshot
  • Loading branch information
ermalkaleci authored Apr 25, 2024
1 parent 1c439ab commit b69f1b9
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 94 deletions.
89 changes: 0 additions & 89 deletions tests/acala/__snapshots__/aggregated-dex.test.ts.snap

This file was deleted.

20 changes: 17 additions & 3 deletions tests/acala/aggregated-dex.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { afterAll, beforeAll, describe, it } from 'vitest'
import { afterAll, beforeAll, describe, expect, it } from 'vitest'
import { sendTransaction } from '@acala-network/chopsticks-testing'

import { Network, createContext, createNetworks } from '../../networks'
Expand Down Expand Up @@ -31,11 +31,15 @@ describe.each([
] as const)('$name aggregatedDex', async ({ name, swapPath }) => {
let chain: Network
const ctx = createContext()
const { alice } = ctx
const { alice, keyring } = ctx

beforeAll(async () => {
const networks = await createNetworks({ [name]: undefined }, ctx)
chain = networks[name]
const meta = await chain.chain.head.meta
if (meta.registry.chainSS58) {
keyring.setSS58Format(meta.registry.chainSS58)
}

// restore Homa.toBondPool to correct liquid token exchange rate
const apiAt = await chain.api.at(await chain.api.rpc.chain.getBlockHash(chain.chain.head.number - 3))
Expand All @@ -58,6 +62,16 @@ describe.each([

await chain.chain.newBlock()

await checkEvents(tx, 'dex').redact({ number: true }).toMatchSnapshot()
await checkEvents(tx, 'dex').toMatchObject([
expect.objectContaining({
method: 'Swap',
section: 'dex',
data: expect.objectContaining({
trader: alice.address,
path: expect.arrayContaining(swapPath[0].Dex as any),
liquidityChanges: expect.arrayContaining([1e10]),
}),
}),
])
})
})
2 changes: 1 addition & 1 deletion tests/bridge-sdk/__snapshots__/kusama.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ exports[`'karura' to 'assetHubKusama' using bridgeSDK cross-chain 'USDT' > Cross
}
`;

exports[`'karura' to 'assetHubKusama' using bridgeSDK cross-chain 'USDT' > Cross-chain using BridgeSDK works > fee 1`] = `"(rounded 0.0006)"`;
exports[`'karura' to 'assetHubKusama' using bridgeSDK cross-chain 'USDT' > Cross-chain using BridgeSDK works > fee 1`] = `"(rounded 0.0005)"`;

exports[`'karura' to 'assetHubKusama' using bridgeSDK cross-chain 'USDT' > Cross-chain using BridgeSDK works > initial 1`] = `
{
Expand Down
2 changes: 1 addition & 1 deletion vitest.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import swc from 'unplugin-swc'

export default defineConfig({
test: {
hookTimeout: 180_000,
hookTimeout: 240_000,
testTimeout: 240_000,
pool: 'forks',
passWithNoTests: true,
Expand Down

0 comments on commit b69f1b9

Please sign in to comment.