diff --git a/packages/jellyfish-api-core/__tests__/category/mining.test.ts b/packages/jellyfish-api-core/__tests__/category/mining.test.ts index 98927c7bdd..f080a2f3fb 100644 --- a/packages/jellyfish-api-core/__tests__/category/mining.test.ts +++ b/packages/jellyfish-api-core/__tests__/category/mining.test.ts @@ -113,7 +113,7 @@ describe('masternode', () => { expect(mn1.masternodestate).toStrictEqual('ENABLED') expect(mn1.generate).toStrictEqual(true) expect(mn1.mintedblocks).toStrictEqual(0) - expect(mn1.lastblockcreationattempt).toStrictEqual('0') + expect(mn1.lastblockcreationattempt).not.toStrictEqual('0') expect(info.networkhashps).toBeGreaterThan(0) expect(info.pooledtx).toStrictEqual(0) diff --git a/packages/jellyfish-api-core/__tests__/category/token.test.ts b/packages/jellyfish-api-core/__tests__/category/token.test.ts index 6223d9dac6..2751ffa452 100644 --- a/packages/jellyfish-api-core/__tests__/category/token.test.ts +++ b/packages/jellyfish-api-core/__tests__/category/token.test.ts @@ -312,8 +312,10 @@ describe('masternode', () => { await client.token.updateToken(tokenDABCId, { mintable: false }) await container.generate(1) - const { [tokenDABCId]: tokenAfter } = await client.token.getToken(`DABC#${tokenDABCId}`) - expect(tokenAfter.mintable).toStrictEqual(false) + await waitForExpect(async () => { + const { [tokenDABCId]: tokenAfter } = await client.token.getToken(`DABC#${tokenDABCId}`) + expect(tokenAfter.mintable).toStrictEqual(false) + }) }) it('should updateToken by creationTx', async () => { @@ -324,8 +326,10 @@ describe('masternode', () => { await client.token.updateToken(creationTx, { tradeable: false }) await container.generate(1) - const { [tokenDABCId]: tokenAfter } = await client.token.getToken(`DABC#${tokenDABCId}`) - expect(tokenAfter.tradeable).toStrictEqual(false) + await waitForExpect(async () => { + const { [tokenDABCId]: tokenAfter } = await client.token.getToken(`DABC#${tokenDABCId}`) + expect(tokenAfter.tradeable).toStrictEqual(false) + }) }) }) diff --git a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_account_account_to_account.test.ts b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_account_account_to_account.test.ts index 307e9cc673..99d00a72af 100644 --- a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_account_account_to_account.test.ts +++ b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_account_account_to_account.test.ts @@ -50,7 +50,6 @@ beforeEach(async () => { builder = new P2WPKHTransactionBuilder(providers.fee, providers.prevout, providers.elliptic) // Fund 10 DFI TOKEN - await fundEllipticPair(container, providers.ellipticPair, 10) await providers.setupMocks() // required to move utxos await utxosToAccount(container, 10, { address: await providers.getAddress() }) diff --git a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_dex_poolswap.test.ts b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_dex_poolswap.test.ts index 24eb4da5b7..bfd507d9cc 100644 --- a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_dex_poolswap.test.ts +++ b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_dex_poolswap.test.ts @@ -77,14 +77,15 @@ describe('DFI to DOG', () => { }) it('should poolSwap from DFI to DOG', async () => { - // Fund 10 DFI UTXO - await fundEllipticPair(container, providers.ellipticPair, 10) - // Fund 10 DFI TOKEN + // Fund 100 DFI TOKEN await providers.setupMocks() // required to move utxos await utxosToAccount(container, 100, { address: await providers.getAddress() }) // Fund 10 DOG TOKEN await sendTokensToAddress(container, await providers.getAddress(), 10, 'DOG') + // Fund 10 DFI UTXO + await fundEllipticPair(container, providers.ellipticPair, 10) + // Perform SWAP const script = await providers.elliptic.script() const txn = await builder.dex.poolSwap({ diff --git a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_liq_pool_add_liquidity.test.ts b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_liq_pool_add_liquidity.test.ts index 104962a185..7d5b5d086a 100644 --- a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_liq_pool_add_liquidity.test.ts +++ b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_liq_pool_add_liquidity.test.ts @@ -49,7 +49,6 @@ beforeEach(async () => { builder = new P2WPKHTransactionBuilder(providers.fee, providers.prevout, providers.elliptic) // Fund 100 DFI TOKEN - await fundEllipticPair(container, providers.ellipticPair, 100) await providers.setupMocks() // required to move utxos await utxosToAccount(container, 100, { address: await providers.getAddress() }) diff --git a/packages/testcontainers/__tests__/index.test.ts b/packages/testcontainers/__tests__/index.test.ts index dbb855c2ed..1d5b102b9c 100644 --- a/packages/testcontainers/__tests__/index.test.ts +++ b/packages/testcontainers/__tests__/index.test.ts @@ -55,16 +55,16 @@ describe('regtest', () => { }) describe('regtest: override docker image', () => { - const container = new RegTestContainer('defi/defichain:1.6.0') + const container = new TestNetContainer('defi/defichain:1.6.4') afterAll(async () => { await container.stop() }) - it('should be able to getmintinginfo and chain should be regtest', async () => { + it('should be able to getmintinginfo and chain should be test', async () => { await container.start() await container.waitForReady() const { chain } = await container.getMintingInfo() - expect(chain).toStrictEqual('regtest') + expect(chain).toStrictEqual('test') }) }) diff --git a/packages/testcontainers/src/chains/defid_container.ts b/packages/testcontainers/src/chains/defid_container.ts index 66c664e00f..50774b8329 100644 --- a/packages/testcontainers/src/chains/defid_container.ts +++ b/packages/testcontainers/src/chains/defid_container.ts @@ -22,7 +22,7 @@ export interface StartOptions { export abstract class DeFiDContainer extends DockerContainer { /* eslint-disable @typescript-eslint/no-non-null-assertion, no-void */ public static readonly PREFIX = 'defichain-testcontainers-' - public static readonly image = 'defi/defichain:1.6.4' + public static readonly image = 'defi/defichain:1.7.0' public static readonly DefaultStartOptions = { user: 'testcontainers-user', diff --git a/packages/testcontainers/src/chains/reg_test_container/index.ts b/packages/testcontainers/src/chains/reg_test_container/index.ts index 4de6f78c33..c221640a3e 100644 --- a/packages/testcontainers/src/chains/reg_test_container/index.ts +++ b/packages/testcontainers/src/chains/reg_test_container/index.ts @@ -25,7 +25,8 @@ export class RegTestContainer extends DeFiDContainer { '-bayfrontgardensheight=2', '-clarkequayheight=3', '-dakotaheight=4', - '-dakotacrescentheight=5' + '-dakotacrescentheight=5', + '-eunosheight=6' ] } diff --git a/packages/testing/__tests__/account.test.ts b/packages/testing/__tests__/account.test.ts index f351dd7a95..a46789a89b 100644 --- a/packages/testing/__tests__/account.test.ts +++ b/packages/testing/__tests__/account.test.ts @@ -39,6 +39,7 @@ describe('accountToAccount', () => { await mintTokens(container, symbol) const to = await container.call('getnewaddress') + await container.fundAddress(from, 1) await accountToAccount(container, symbol, 6, { from, to }) const accounts = await container.call('listaccounts') diff --git a/packages/testing/__tests__/poolpair.test.ts b/packages/testing/__tests__/poolpair.test.ts index cca4dc8d18..6ab2e7b003 100644 --- a/packages/testing/__tests__/poolpair.test.ts +++ b/packages/testing/__tests__/poolpair.test.ts @@ -1,5 +1,6 @@ import { MasterNodeRegTestContainer } from '@defichain/testcontainers' import { createToken, createPoolPair, addPoolLiquidity, mintTokens, utxosToAccount, removePoolLiquidity } from '../src' +import waitForExpect from 'wait-for-expect' const container = new MasterNodeRegTestContainer() @@ -60,7 +61,9 @@ describe('add/remove pool pair liquidity', () => { tokenLP: 'DFI-LPT' }) - const shares: Record = await container.call('listpoolshares') - expect(Object.keys(shares).length).toStrictEqual(0) + await waitForExpect(async () => { + const shares: Record = await container.call('listpoolshares') + expect(Object.keys(shares).length).toStrictEqual(0) + }) }) })