Skip to content

Commit

Permalink
waitForPath
Browse files Browse the repository at this point in the history
  • Loading branch information
canonbrother committed May 31, 2024
1 parent 9010fe4 commit 41772f3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
10 changes: 10 additions & 0 deletions apps/whale-api/src/e2e.defid.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -863,6 +863,16 @@ export class DefidBin {
}, timeout, 100, 'waitForWalletBalanceGTE')
}

async waitForPath (controller: DPoolPairController, timeout: number = 300000): Promise<void> {
return await waitForCondition(async () => {
const res = await controller.listSwappableTokens('0')
if (res.swappableTokens.length > 0) {
return true
}
return false
}, timeout, 100, 'waitForPath')
}

async fundAddress (address: string, amount: number): Promise<{ txid: string, vout: number }> {
const txid = await this.call('sendtoaddress', [address, amount])
await this.generate(1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ beforeAll(async () => {
// const tkey = `${CachePrefix.TOKEN_INFO} 31`
// const token = await cache.get<TokenInfo>(tkey)
// expect(token?.symbolKey).toStrictEqual('USDT-DFI')

await app.waitForPath(controller)
})

afterAll(async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ beforeAll(async () => {
// for (const k in tokenResult) {
// await defiCache.getTokenInfo(k)
// }

await app.waitForPath(controller)
})

afterAll(async () => {
Expand Down Expand Up @@ -176,7 +178,7 @@ async function setup (): Promise<void> {
await app.generate(1)
}

describe('get best path - DEX burn fees', () => {
describe.only('get best path - DEX burn fees', () => {
it('should return fees - CAT to DFI - Both token fees direction are in', async () => {
const paths1 = await controller.getBestPath('3', '0')
expect(paths1.bestPath).toStrictEqual([
Expand Down

0 comments on commit 41772f3

Please sign in to comment.