Skip to content

Commit

Permalink
Merge pull request #1072 from gorbak25/speed_up_tests
Browse files Browse the repository at this point in the history
Speed up some tests 5 times
  • Loading branch information
mradkov authored Oct 6, 2020
2 parents 77777f8 + 9ec8ddf commit 83828dd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions test/integration/chain.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('Node Chain', function () {

it('waits for specified heights', async () => {
const target = await client.height() + 1
await client.awaitHeight(target, { attempts: 120 }).should.eventually.be.at.least(target)
await client.awaitHeight(target, { interval: 200, attempts: 100 }).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 @@ -87,17 +87,17 @@ describe('Node Chain', function () {
const signed = await client.signTransaction(tx)
const { txHash } = await client.api.postTransaction({ tx: signed })

await client.poll(txHash).should.eventually.be.fulfilled
return client.poll('th_xxx', { blocks: 1 }).should.eventually.be.rejected
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
})

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

isConfirmed.should.be.equal(true)

const txData2 = await client.spend(1000, await client.address(), { confirm: 4 })
const txData2 = await client.spend(1000, await client.address(), { confirm: 4, interval: 200, attempts: 100 })
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)
await contract.poll(deployed.transaction, { interval: 50, attempts: 1200 })
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)
await contract.poll(result.hash, { interval: 50, attempts: 1200 })
})

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)
await contract.poll(deployed.transaction, { interval: 50, attempts: 1200 })
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)
await contract.poll(result.hash, { interval: 50, attempts: 1200 })
})
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: { Swagger: { defaults: { debug: !!process.env.DEBUG } } },
deepProps: { Ae: { defaults: { interval: 50, attempts: 1200 } }, Swagger: { defaults: { debug: !!process.env.DEBUG } } },
props: { process, compilerUrl }
})({
...params,
Expand Down

0 comments on commit 83828dd

Please sign in to comment.