Merge tag 'v2.1.2' of github.com:OpenZeppelin/openzeppelin-solidity into merge-v2.1

v2.1.2
This commit is contained in:
Francisco Giordano
2019-01-21 19:42:09 -03:00
96 changed files with 4366 additions and 5226 deletions

View File

@ -1,15 +1,10 @@
const shouldFail = require('../../helpers/shouldFail');
const expectEvent = require('../../helpers/expectEvent');
const { balanceDifference } = require('../../helpers/balanceDifference');
const { ether } = require('../../helpers/ether');
const { ZERO_ADDRESS } = require('../../helpers/constants');
require('../../helpers/setup');
const { balance, constants, ether, expectEvent, shouldFail } = require('openzeppelin-test-helpers');
const { ZERO_ADDRESS } = constants;
const RefundEscrow = artifacts.require('RefundEscrowMock');
contract('RefundEscrow', function ([_, primary, beneficiary, refundee1, refundee2]) {
const amount = ether(54.0);
const amount = ether('54');
const refundees = [refundee1, refundee2];
it('requires a non-null beneficiary', async function () {
@ -26,7 +21,7 @@ contract('RefundEscrow', function ([_, primary, beneficiary, refundee1, refundee
context('active state', function () {
it('has beneficiary and state', async function () {
(await this.escrow.beneficiary()).should.be.equal(beneficiary);
(await this.escrow.state()).should.be.bignumber.equal(0);
(await this.escrow.state()).should.be.bignumber.equal('0');
});
it('accepts deposits', async function () {
@ -69,9 +64,9 @@ contract('RefundEscrow', function ([_, primary, beneficiary, refundee1, refundee
});
it('allows beneficiary withdrawal', async function () {
(await balanceDifference(beneficiary, () =>
(await balance.difference(beneficiary, () =>
this.escrow.beneficiaryWithdraw()
)).should.be.bignumber.equal(amount * refundees.length);
)).should.be.bignumber.equal(amount.muln(refundees.length));
});
it('prevents entering the refund state', async function () {
@ -103,7 +98,7 @@ contract('RefundEscrow', function ([_, primary, beneficiary, refundee1, refundee
it('refunds refundees', async function () {
for (const refundee of [refundee1, refundee2]) {
(await balanceDifference(refundee, () =>
(await balance.difference(refundee, () =>
this.escrow.withdraw(refundee, { from: primary }))
).should.be.bignumber.equal(amount);
}