Skip to content

Commit

Permalink
Merge pull request #1110 from aeternity/feature/fix-tests
Browse files Browse the repository at this point in the history
Fix integration tests
  • Loading branch information
mradkov authored Mar 1, 2021
2 parents 241367c + 2397e30 commit c856244
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions docker/aeternity_node_mean16.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ chain:
mining:
autostart: true
beneficiary: "ak_2iBPH7HUz3cSDVEUWiHg76MZJ6tZooVNBmmxcgVK6VV8KAE688"
expected_mine_rate: 1000
micro_block_cycle: 200
expected_mine_rate: 4000
micro_block_cycle: 1000
cuckoo:
miner:
executable: mean15-generic
Expand Down
10 changes: 5 additions & 5 deletions test/integration/chain.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe('Node Chain', function () {

it('waits for specified heights', async () => {
const target = await client.height() + 1
await client.awaitHeight(target, { interval: 200, attempts: 100 }).should.eventually.be.at.least(target)
await client.awaitHeight(target, { attempts: 120 }).should.eventually.be.at.least(target)
return client.height().should.eventually.be.at.least(target)
})
it('Can verify transaction from broadcast error', async () => {
Expand Down Expand Up @@ -109,17 +109,17 @@ describe('Node Chain', function () {
const signed = await client.signTransaction(tx)
const { txHash } = await client.api.postTransaction({ tx: signed })

await client.poll(txHash, { interval: 50, attempts: 1200 }).should.eventually.be.fulfilled
return client.poll('th_xxx', { blocks: 1, interval: 50, attempts: 1200 }).should.eventually.be.rejected
await client.poll(txHash).should.eventually.be.fulfilled
return client.poll('th_xxx', { blocks: 1 }).should.eventually.be.rejected
})

it('Wait for transaction confirmation', async () => {
const txData = await client.spend(1000, await client.address(), { confirm: true, interval: 400, attempts: 50 })
const txData = await client.spend(1000, await client.address(), { confirm: true })
const isConfirmed = (await client.height()) >= txData.blockHeight + 3

isConfirmed.should.be.equal(true)

const txData2 = await client.spend(1000, await client.address(), { confirm: 4, interval: 400, attempts: 50 })
const txData2 = await client.spend(1000, await client.address(), { confirm: 4 })
const isConfirmed2 = (await client.height()) >= txData2.blockHeight + 4
isConfirmed2.should.be.equal(true)
})
Expand Down
8 changes: 4 additions & 4 deletions test/integration/contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -392,13 +392,13 @@ describe('Contract', function () {

it('call contract/deploy with `waitMined: false`', async () => {
const deployed = await bytecode.deploy([], { waitMined: false })
await contract.poll(deployed.transaction, { interval: 50, attempts: 1200 })
await contract.poll(deployed.transaction)
Boolean(deployed.result === undefined).should.be.equal(true)
Boolean(deployed.txData === undefined).should.be.equal(true)
const result = await deployed.call('main', ['42'], { waitMined: false, verify: false })
Boolean(result.result === undefined).should.be.equal(true)
Boolean(result.txData === undefined).should.be.equal(true)
await contract.poll(result.hash, { interval: 50, attempts: 1200 })
await contract.poll(result.hash)
})

it('calls deployed contracts static', async () => {
Expand Down Expand Up @@ -645,13 +645,13 @@ describe('Contract', function () {
})
it('Deploy/Call contract with { waitMined: false }', async () => {
const deployed = await contractObject.methods.init('123', 1, 'hahahaha', { waitMined: false })
await contract.poll(deployed.transaction, { interval: 50, attempts: 1200 })
await contract.poll(deployed.transaction)
Boolean(deployed.result === undefined).should.be.equal(true)
Boolean(deployed.txData === undefined).should.be.equal(true)
const result = await contractObject.methods.intFn.send(2, { waitMined: false })
Boolean(result.result === undefined).should.be.equal(true)
Boolean(result.txData === undefined).should.be.equal(true)
await contract.poll(result.hash, { interval: 50, attempts: 1200 })
await contract.poll(result.hash)
})
it('Generate ACI object with corresponding bytecode', async () => {
await contract.getContractInstance(testContract, { contractAddress: contractObject.deployInfo.address, filesystem, opt: { ttl: 0 } })
Expand Down
2 changes: 1 addition & 1 deletion test/integration/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const account = Crypto.generateKeyPair()

export const BaseAe = async (params = {}) => {
const ae = await Universal.waitMined(true).compose({
deepProps: { Ae: { defaults: { interval: 50, attempts: 1200 } }, Swagger: { defaults: { debug: !!process.env.DEBUG } } },
deepProps: { Swagger: { defaults: { debug: !!process.env.DEBUG } } },
props: { process, compilerUrl }
})({
...params,
Expand Down

0 comments on commit c856244

Please sign in to comment.