Skip to content

Commit cd2584c

Browse files
committed
Promisify other sync requests
1 parent c80989b commit cd2584c

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

test/Bounty.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ contract('Bounty', function (accounts) {
2525
let owner = accounts[0];
2626
let reward = web3.toWei(1, 'ether');
2727
let bounty = await SecureTargetBounty.new();
28-
sendReward(owner, bounty.address, reward);
28+
await sendReward(owner, bounty.address, reward);
2929

3030
const balance = await toPromise(web3.eth.getBalance)(bounty.address);
3131
assert.equal(reward, balance.toNumber());
@@ -35,7 +35,7 @@ contract('Bounty', function (accounts) {
3535
let owner = accounts[0];
3636
let reward = web3.toWei(1, 'ether');
3737
let bounty = await SecureTargetBounty.new();
38-
sendReward(owner, bounty.address, reward);
38+
await sendReward(owner, bounty.address, reward);
3939

4040
const balance = await toPromise(web3.eth.getBalance)(bounty.address);
4141
assert.equal(reward, balance.toNumber());
@@ -58,7 +58,7 @@ contract('Bounty', function (accounts) {
5858
if (err) { throw err; }
5959

6060
var targetAddress = result.args.createdAddress;
61-
sendReward(owner, bounty.address, reward);
61+
await sendReward(owner, bounty.address, reward);
6262

6363
const balance = await toPromise(web3.eth.getBalance)(bounty.address);
6464
assert.equal(reward, balance.toNumber());
@@ -95,7 +95,7 @@ contract('Bounty', function (accounts) {
9595
event.stopWatching();
9696
if (err) { throw err; }
9797
let targetAddress = result.args.createdAddress;
98-
sendReward(owner, bounty.address, reward);
98+
await sendReward(owner, bounty.address, reward);
9999

100100
const balance = await toPromise(web3.eth.getBalance)(bounty.address);
101101
assert.equal(reward, balance.toNumber());

test/examples/SimpleToken.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ contract('SimpleToken', accounts => {
3030

3131
assert(creatorBalance.eq(totalSupply));
3232

33-
const receipt = web3.eth.getTransactionReceipt(token.transactionHash);
33+
const receipt = await web3.eth.getTransactionReceipt(token.transactionHash);
3434
const logs = decodeLogs(receipt.logs, SimpleToken, token.address);
3535
assert.equal(logs.length, 1);
3636
assert.equal(logs[0].event, 'Transfer');

test/token/ERC20/TokenVesting.test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import EVMRevert from '../../helpers/EVMRevert';
22
import latestTime from '../../helpers/latestTime';
33
import { increaseTimeTo, duration } from '../../helpers/increaseTime';
4+
import toPromise from '../../helpers/toPromise';
45

56
const BigNumber = web3.BigNumber;
67

@@ -40,7 +41,8 @@ contract('TokenVesting', function ([_, owner, beneficiary]) {
4041
await increaseTimeTo(this.start + this.cliff);
4142

4243
const { receipt } = await this.vesting.release(this.token.address);
43-
const releaseTime = web3.eth.getBlock(receipt.blockNumber).timestamp;
44+
const block = await toPromise(web3.eth.getBlock)(receipt.blockNumber);
45+
const releaseTime = block.timestamp;
4446

4547
const balance = await this.token.balanceOf(beneficiary);
4648
balance.should.bignumber.equal(amount.mul(releaseTime - this.start).div(this.duration).floor());

0 commit comments

Comments
 (0)