diff --git a/test/access/Roles.test.js b/test/access/Roles.test.js index bd56f1a6e..7358a2195 100644 --- a/test/access/Roles.test.js +++ b/test/access/Roles.test.js @@ -8,7 +8,7 @@ contract('Roles', function ([_, authorized, otherAuthorized, anyone]) { }); it('reverts when querying roles for the null account', async function () { - await shouldFail.reverting(this.roles.has(constants.ZERO_ADDRESS)); + await shouldFail.reverting(this.roles.has(ZERO_ADDRESS)); }); context('initially', function () { @@ -31,7 +31,7 @@ contract('Roles', function ([_, authorized, otherAuthorized, anyone]) { }); it('reverts when adding roles to the null account', async function () { - await shouldFail.reverting(this.roles.add(constants.ZERO_ADDRESS)); + await shouldFail.reverting(this.roles.add(ZERO_ADDRESS)); }); }); }); @@ -54,7 +54,7 @@ contract('Roles', function ([_, authorized, otherAuthorized, anyone]) { }); it('reverts when removing roles from the null account', async function () { - await shouldFail.reverting(this.roles.remove(constants.ZERO_ADDRESS)); + await shouldFail.reverting(this.roles.remove(ZERO_ADDRESS)); }); }); }); diff --git a/test/access/roles/PublicRole.behavior.js b/test/access/roles/PublicRole.behavior.js index 508ff9b20..4c4f34706 100644 --- a/test/access/roles/PublicRole.behavior.js +++ b/test/access/roles/PublicRole.behavior.js @@ -1,4 +1,5 @@ const { shouldFail, constants, expectEvent } = require('openzeppelin-test-helpers'); +const { ZERO_ADDRESS } = constants; function capitalize (str) { return str.replace(/\b\w/g, l => l.toUpperCase()); @@ -23,7 +24,7 @@ function shouldBehaveLikePublicRole (authorized, otherAuthorized, [anyone], role } it('reverts when querying roles for the null account', async function () { - await shouldFail.reverting(this.contract[`is${rolename}`](constants.ZERO_ADDRESS)); + await shouldFail.reverting(this.contract[`is${rolename}`](ZERO_ADDRESS)); }); describe('access control', function () { @@ -63,7 +64,7 @@ function shouldBehaveLikePublicRole (authorized, otherAuthorized, [anyone], role }); it('reverts when adding role to the null account', async function () { - await shouldFail.reverting(this.contract[`add${rolename}`](constants.ZERO_ADDRESS, { from })); + await shouldFail.reverting(this.contract[`add${rolename}`](ZERO_ADDRESS, { from })); }); }); }); @@ -89,7 +90,7 @@ function shouldBehaveLikePublicRole (authorized, otherAuthorized, [anyone], role }); it('reverts when removing role from the null account', async function () { - await shouldFail.reverting(this.contract[`remove${rolename}`](constants.ZERO_ADDRESS), { from }); + await shouldFail.reverting(this.contract[`remove${rolename}`](ZERO_ADDRESS), { from }); }); }); }); diff --git a/test/crowdsale/AllowanceCrowdsale.test.js b/test/crowdsale/AllowanceCrowdsale.test.js index 9a1e9b0e1..d6bec5b78 100644 --- a/test/crowdsale/AllowanceCrowdsale.test.js +++ b/test/crowdsale/AllowanceCrowdsale.test.js @@ -1,4 +1,5 @@ const { balance, BN, constants, ether, expectEvent, shouldFail } = require('openzeppelin-test-helpers'); +const { ZERO_ADDRESS } = constants; const AllowanceCrowdsaleImpl = artifacts.require('AllowanceCrowdsaleImpl'); const SimpleToken = artifacts.require('SimpleToken'); @@ -74,7 +75,7 @@ contract('AllowanceCrowdsale', function ([_, investor, wallet, purchaser, tokenW describe('when token wallet is different from token address', function () { it('creation reverts', async function () { this.token = await SimpleToken.new({ from: tokenWallet }); - await shouldFail.reverting(AllowanceCrowdsaleImpl.new(rate, wallet, this.token.address, constants.ZERO_ADDRESS)); + await shouldFail.reverting(AllowanceCrowdsaleImpl.new(rate, wallet, this.token.address, ZERO_ADDRESS)); }); }); }); diff --git a/test/crowdsale/Crowdsale.test.js b/test/crowdsale/Crowdsale.test.js index 006f7d7b5..d2c00b9aa 100644 --- a/test/crowdsale/Crowdsale.test.js +++ b/test/crowdsale/Crowdsale.test.js @@ -1,4 +1,5 @@ const { balance, BN, constants, ether, expectEvent, shouldFail } = require('openzeppelin-test-helpers'); +const { ZERO_ADDRESS } = constants; const Crowdsale = artifacts.require('CrowdsaleMock'); const SimpleToken = artifacts.require('SimpleToken'); @@ -11,7 +12,7 @@ contract('Crowdsale', function ([_, investor, wallet, purchaser]) { it('requires a non-null token', async function () { await shouldFail.reverting( - Crowdsale.new(rate, wallet, constants.ZERO_ADDRESS) + Crowdsale.new(rate, wallet, ZERO_ADDRESS) ); }); @@ -28,7 +29,7 @@ contract('Crowdsale', function ([_, investor, wallet, purchaser]) { it('requires a non-null wallet', async function () { await shouldFail.reverting( - Crowdsale.new(rate, constants.ZERO_ADDRESS, this.token.address) + Crowdsale.new(rate, ZERO_ADDRESS, this.token.address) ); }); @@ -64,7 +65,7 @@ contract('Crowdsale', function ([_, investor, wallet, purchaser]) { it('requires a non-null beneficiary', async function () { await shouldFail.reverting( - this.crowdsale.buyTokens(constants.ZERO_ADDRESS, { value: value, from: purchaser }) + this.crowdsale.buyTokens(ZERO_ADDRESS, { value: value, from: purchaser }) ); }); }); diff --git a/test/drafts/ERC20Migrator.test.js b/test/drafts/ERC20Migrator.test.js index dd291dc3e..bc2a6e058 100644 --- a/test/drafts/ERC20Migrator.test.js +++ b/test/drafts/ERC20Migrator.test.js @@ -1,4 +1,5 @@ const { BN, constants, shouldFail } = require('openzeppelin-test-helpers'); +const { ZERO_ADDRESS } = constants; const ERC20Mock = artifacts.require('ERC20Mock'); const ERC20Mintable = artifacts.require('ERC20Mintable'); @@ -8,7 +9,7 @@ contract('ERC20Migrator', function ([_, owner, recipient, anotherAccount]) { const totalSupply = new BN('200'); it('reverts with a null legacy token address', async function () { - await shouldFail.reverting(ERC20Migrator.new(constants.ZERO_ADDRESS)); + await shouldFail.reverting(ERC20Migrator.new(ZERO_ADDRESS)); }); describe('with tokens and migrator', function () { @@ -24,7 +25,7 @@ contract('ERC20Migrator', function ([_, owner, recipient, anotherAccount]) { describe('beginMigration', function () { it('reverts with a null new token address', async function () { - await shouldFail.reverting(this.migrator.beginMigration(constants.ZERO_ADDRESS)); + await shouldFail.reverting(this.migrator.beginMigration(ZERO_ADDRESS)); }); it('reverts if not a minter of the token', async function () { diff --git a/test/drafts/TokenVesting.test.js b/test/drafts/TokenVesting.test.js index 5f6d3f07a..d9474a187 100644 --- a/test/drafts/TokenVesting.test.js +++ b/test/drafts/TokenVesting.test.js @@ -1,4 +1,5 @@ const { BN, constants, expectEvent, shouldFail, time } = require('openzeppelin-test-helpers'); +const { ZERO_ADDRESS } = constants; const ERC20Mintable = artifacts.require('ERC20Mintable'); const TokenVesting = artifacts.require('TokenVesting'); @@ -26,7 +27,7 @@ contract('TokenVesting', function ([_, owner, beneficiary]) { it('reverts with a null beneficiary', async function () { await shouldFail.reverting( - TokenVesting.new(constants.ZERO_ADDRESS, this.start, this.cliffDuration, this.duration, true, { from: owner }) + TokenVesting.new(ZERO_ADDRESS, this.start, this.cliffDuration, this.duration, true, { from: owner }) ); }); diff --git a/test/examples/SimpleToken.test.js b/test/examples/SimpleToken.test.js index 61d71bd3e..1ec65ee07 100644 --- a/test/examples/SimpleToken.test.js +++ b/test/examples/SimpleToken.test.js @@ -1,4 +1,5 @@ const { constants, expectEvent } = require('openzeppelin-test-helpers'); +const { ZERO_ADDRESS } = constants; const SimpleToken = artifacts.require('SimpleToken'); @@ -26,7 +27,7 @@ contract('SimpleToken', function ([_, creator]) { creatorBalance.should.be.bignumber.equal(totalSupply); await expectEvent.inConstruction(this.token, 'Transfer', { - from: constants.ZERO_ADDRESS, + from: ZERO_ADDRESS, to: creator, value: totalSupply, }); diff --git a/test/math/SafeMath.test.js b/test/math/SafeMath.test.js index a0d69aae1..7771ffb81 100644 --- a/test/math/SafeMath.test.js +++ b/test/math/SafeMath.test.js @@ -1,4 +1,5 @@ const { BN, constants, shouldFail } = require('openzeppelin-test-helpers'); +const { ZERO_ADDRESS } = constants; const SafeMathMock = artifacts.require('SafeMathMock'); diff --git a/test/ownership/Ownable.behavior.js b/test/ownership/Ownable.behavior.js index a6a32b466..5e90222f2 100644 --- a/test/ownership/Ownable.behavior.js +++ b/test/ownership/Ownable.behavior.js @@ -1,4 +1,5 @@ const { constants, expectEvent, shouldFail } = require('openzeppelin-test-helpers'); +const { ZERO_ADDRESS } = constants; function shouldBehaveLikeOwnable (owner, [anyone]) { describe('as an ownable', function () { @@ -20,14 +21,14 @@ function shouldBehaveLikeOwnable (owner, [anyone]) { }); it('should guard ownership against stuck state', async function () { - await shouldFail.reverting(this.ownable.transferOwnership(constants.ZERO_ADDRESS, { from: owner })); + await shouldFail.reverting(this.ownable.transferOwnership(ZERO_ADDRESS, { from: owner })); }); it('loses owner after renouncement', async function () { const { logs } = await this.ownable.renounceOwnership({ from: owner }); expectEvent.inLogs(logs, 'OwnershipTransferred'); - (await this.ownable.owner()).should.equal(constants.ZERO_ADDRESS); + (await this.ownable.owner()).should.equal(ZERO_ADDRESS); }); it('should prevent non-owners from renouncement', async function () { diff --git a/test/ownership/Secondary.test.js b/test/ownership/Secondary.test.js index f12c1ea78..e46784a15 100644 --- a/test/ownership/Secondary.test.js +++ b/test/ownership/Secondary.test.js @@ -1,4 +1,5 @@ const { constants, expectEvent, shouldFail } = require('openzeppelin-test-helpers'); +const { ZERO_ADDRESS } = constants; const SecondaryMock = artifacts.require('SecondaryMock'); @@ -29,7 +30,7 @@ contract('Secondary', function ([_, primary, newPrimary, anyone]) { }); it('reverts when transfering to the null address', async function () { - await shouldFail.reverting(this.secondary.transferPrimary(constants.ZERO_ADDRESS, { from: primary })); + await shouldFail.reverting(this.secondary.transferPrimary(ZERO_ADDRESS, { from: primary })); }); it('reverts when called by anyone', async function () { diff --git a/test/payment/PaymentSplitter.test.js b/test/payment/PaymentSplitter.test.js index 2e2cfbb66..fae149002 100644 --- a/test/payment/PaymentSplitter.test.js +++ b/test/payment/PaymentSplitter.test.js @@ -1,4 +1,5 @@ const { balance, constants, ether, expectEvent, send, shouldFail } = require('openzeppelin-test-helpers'); +const { ZERO_ADDRESS } = constants; const PaymentSplitter = artifacts.require('PaymentSplitter'); @@ -18,7 +19,7 @@ contract('PaymentSplitter', function ([_, owner, payee1, payee2, payee3, nonpaye }); it('rejects null payees', async function () { - await shouldFail.reverting(PaymentSplitter.new([payee1, constants.ZERO_ADDRESS], [20, 30])); + await shouldFail.reverting(PaymentSplitter.new([payee1, ZERO_ADDRESS], [20, 30])); }); it('rejects zero-valued shares', async function () { diff --git a/test/payment/escrow/RefundEscrow.test.js b/test/payment/escrow/RefundEscrow.test.js index fd45cee1d..629486253 100644 --- a/test/payment/escrow/RefundEscrow.test.js +++ b/test/payment/escrow/RefundEscrow.test.js @@ -1,4 +1,5 @@ const { balance, constants, ether, expectEvent, shouldFail } = require('openzeppelin-test-helpers'); +const { ZERO_ADDRESS } = constants; const RefundEscrow = artifacts.require('RefundEscrow'); @@ -8,7 +9,7 @@ contract('RefundEscrow', function ([_, primary, beneficiary, refundee1, refundee it('requires a non-null beneficiary', async function () { await shouldFail.reverting( - RefundEscrow.new(constants.ZERO_ADDRESS, { from: primary }) + RefundEscrow.new(ZERO_ADDRESS, { from: primary }) ); }); diff --git a/test/token/ERC20/ERC20.test.js b/test/token/ERC20/ERC20.test.js index 858ea5c6f..1c71cd21f 100644 --- a/test/token/ERC20/ERC20.test.js +++ b/test/token/ERC20/ERC20.test.js @@ -1,4 +1,5 @@ const { BN, constants, expectEvent, shouldFail } = require('openzeppelin-test-helpers'); +const { ZERO_ADDRESS } = constants; const ERC20Mock = artifacts.require('ERC20Mock'); @@ -64,7 +65,7 @@ contract('ERC20', function ([_, initialHolder, recipient, anotherAccount]) { }); describe('when the recipient is the zero address', function () { - const to = constants.ZERO_ADDRESS; + const to = ZERO_ADDRESS; it('reverts', async function () { await shouldFail.reverting(this.token.transfer(to, initialSupply, { from: initialHolder })); @@ -147,7 +148,7 @@ contract('ERC20', function ([_, initialHolder, recipient, anotherAccount]) { describe('when the spender is the zero address', function () { const amount = initialSupply; - const spender = constants.ZERO_ADDRESS; + const spender = ZERO_ADDRESS; it('reverts', async function () { await shouldFail.reverting(this.token.approve(spender, amount, { from: initialHolder })); @@ -238,7 +239,7 @@ contract('ERC20', function ([_, initialHolder, recipient, anotherAccount]) { describe('when the recipient is the zero address', function () { const amount = initialSupply; - const to = constants.ZERO_ADDRESS; + const to = ZERO_ADDRESS; beforeEach(async function () { await this.token.approve(spender, amount, { from: initialHolder }); @@ -312,7 +313,7 @@ contract('ERC20', function ([_, initialHolder, recipient, anotherAccount]) { describe('when the spender is the zero address', function () { const amount = initialSupply; - const spender = constants.ZERO_ADDRESS; + const spender = ZERO_ADDRESS; it('reverts', async function () { await shouldFail.reverting(this.token.decreaseAllowance(spender, amount, { from: initialHolder })); @@ -394,7 +395,7 @@ contract('ERC20', function ([_, initialHolder, recipient, anotherAccount]) { }); describe('when the spender is the zero address', function () { - const spender = constants.ZERO_ADDRESS; + const spender = ZERO_ADDRESS; it('reverts', async function () { await shouldFail.reverting(this.token.increaseAllowance(spender, amount, { from: initialHolder })); @@ -406,7 +407,7 @@ contract('ERC20', function ([_, initialHolder, recipient, anotherAccount]) { const amount = new BN(50); it('rejects a null account', async function () { - await shouldFail.reverting(this.token.mint(constants.ZERO_ADDRESS, amount)); + await shouldFail.reverting(this.token.mint(ZERO_ADDRESS, amount)); }); describe('for a non null account', function () { @@ -426,7 +427,7 @@ contract('ERC20', function ([_, initialHolder, recipient, anotherAccount]) { it('emits Transfer event', async function () { const event = expectEvent.inLogs(this.logs, 'Transfer', { - from: constants.ZERO_ADDRESS, + from: ZERO_ADDRESS, to: recipient, }); @@ -437,7 +438,7 @@ contract('ERC20', function ([_, initialHolder, recipient, anotherAccount]) { describe('_burn', function () { it('rejects a null account', async function () { - await shouldFail.reverting(this.token.burn(constants.ZERO_ADDRESS, new BN(1))); + await shouldFail.reverting(this.token.burn(ZERO_ADDRESS, new BN(1))); }); describe('for a non null account', function () { @@ -465,7 +466,7 @@ contract('ERC20', function ([_, initialHolder, recipient, anotherAccount]) { it('emits Transfer event', async function () { const event = expectEvent.inLogs(this.logs, 'Transfer', { from: initialHolder, - to: constants.ZERO_ADDRESS, + to: ZERO_ADDRESS, }); event.args.value.should.be.bignumber.equal(amount); @@ -488,7 +489,7 @@ contract('ERC20', function ([_, initialHolder, recipient, anotherAccount]) { }); it('rejects a null account', async function () { - await shouldFail.reverting(this.token.burnFrom(constants.ZERO_ADDRESS, new BN(1))); + await shouldFail.reverting(this.token.burnFrom(ZERO_ADDRESS, new BN(1))); }); describe('for a non null account', function () { @@ -525,7 +526,7 @@ contract('ERC20', function ([_, initialHolder, recipient, anotherAccount]) { it('emits a Transfer event', async function () { const event = expectEvent.inLogs(this.logs, 'Transfer', { from: initialHolder, - to: constants.ZERO_ADDRESS, + to: ZERO_ADDRESS, }); event.args.value.should.be.bignumber.equal(amount); diff --git a/test/token/ERC20/behaviors/ERC20Burnable.behavior.js b/test/token/ERC20/behaviors/ERC20Burnable.behavior.js index f90217b23..1c60d81ed 100644 --- a/test/token/ERC20/behaviors/ERC20Burnable.behavior.js +++ b/test/token/ERC20/behaviors/ERC20Burnable.behavior.js @@ -1,4 +1,5 @@ const { BN, constants, expectEvent, shouldFail } = require('openzeppelin-test-helpers'); +const { ZERO_ADDRESS } = constants; function shouldBehaveLikeERC20Burnable (owner, initialBalance, [burner]) { describe('burn', function () { @@ -23,7 +24,7 @@ function shouldBehaveLikeERC20Burnable (owner, initialBalance, [burner]) { it('emits a transfer event', async function () { expectEvent.inLogs(this.logs, 'Transfer', { from: owner, - to: constants.ZERO_ADDRESS, + to: ZERO_ADDRESS, value: amount, }); }); @@ -69,7 +70,7 @@ function shouldBehaveLikeERC20Burnable (owner, initialBalance, [burner]) { it('emits a transfer event', async function () { expectEvent.inLogs(this.logs, 'Transfer', { from: owner, - to: constants.ZERO_ADDRESS, + to: ZERO_ADDRESS, value: amount, }); }); diff --git a/test/token/ERC20/behaviors/ERC20Mintable.behavior.js b/test/token/ERC20/behaviors/ERC20Mintable.behavior.js index a2b3b7b3f..08de77864 100644 --- a/test/token/ERC20/behaviors/ERC20Mintable.behavior.js +++ b/test/token/ERC20/behaviors/ERC20Mintable.behavior.js @@ -1,4 +1,5 @@ const { BN, constants, expectEvent, shouldFail } = require('openzeppelin-test-helpers'); +const { ZERO_ADDRESS } = constants; function shouldBehaveLikeERC20Mintable (minter, [anyone]) { describe('as a mintable token', function () { @@ -27,7 +28,7 @@ function shouldBehaveLikeERC20Mintable (minter, [anyone]) { it('emits a mint and a transfer event', async function () { expectEvent.inLogs(this.logs, 'Transfer', { - from: constants.ZERO_ADDRESS, + from: ZERO_ADDRESS, to: anyone, value: amount, }); diff --git a/test/token/ERC721/ERC721.behavior.js b/test/token/ERC721/ERC721.behavior.js index f6f9b5325..188706762 100644 --- a/test/token/ERC721/ERC721.behavior.js +++ b/test/token/ERC721/ERC721.behavior.js @@ -1,4 +1,5 @@ const { BN, constants, expectEvent, shouldFail } = require('openzeppelin-test-helpers'); +const { ZERO_ADDRESS } = constants; const { shouldSupportInterfaces } = require('../../introspection/SupportsInterface.behavior'); const ERC721ReceiverMock = artifacts.require('ERC721ReceiverMock.sol'); @@ -35,7 +36,7 @@ function shouldBehaveLikeERC721 ( context('when querying the zero address', function () { it('throws', async function () { - await shouldFail.reverting(this.token.balanceOf(constants.ZERO_ADDRESS)); + await shouldFail.reverting(this.token.balanceOf(ZERO_ADDRESS)); }); }); }); @@ -75,7 +76,7 @@ function shouldBehaveLikeERC721 ( }); it('clears the approval for the token ID', async function () { - (await this.token.getApproved(tokenId)).should.be.equal(constants.ZERO_ADDRESS); + (await this.token.getApproved(tokenId)).should.be.equal(ZERO_ADDRESS); }); if (approved) { @@ -133,7 +134,7 @@ function shouldBehaveLikeERC721 ( context('when called by the owner without an approved user', function () { beforeEach(async function () { - await this.token.approve(constants.ZERO_ADDRESS, tokenId, { from: owner }); + await this.token.approve(ZERO_ADDRESS, tokenId, { from: owner }); ({ logs } = await transferFunction.call(this, owner, this.toWhom, tokenId, { from: operator })); }); transferWasSuccessful({ owner, tokenId, approved: null }); @@ -149,7 +150,7 @@ function shouldBehaveLikeERC721 ( }); it('clears the approval for the token ID', async function () { - (await this.token.getApproved(tokenId)).should.be.equal(constants.ZERO_ADDRESS); + (await this.token.getApproved(tokenId)).should.be.equal(ZERO_ADDRESS); }); it('emits only a transfer event', async function () { @@ -199,7 +200,7 @@ function shouldBehaveLikeERC721 ( context('when the address to transfer the token to is the zero address', function () { it('reverts', async function () { await shouldFail.reverting( - transferFunction.call(this, owner, constants.ZERO_ADDRESS, tokenId, { from: owner }) + transferFunction.call(this, owner, ZERO_ADDRESS, tokenId, { from: owner }) ); }); }); @@ -315,7 +316,7 @@ function shouldBehaveLikeERC721 ( const itClearsApproval = function () { it('clears approval for the token', async function () { - (await this.token.getApproved(tokenId)).should.be.equal(constants.ZERO_ADDRESS); + (await this.token.getApproved(tokenId)).should.be.equal(ZERO_ADDRESS); }); }; @@ -338,21 +339,21 @@ function shouldBehaveLikeERC721 ( context('when clearing approval', function () { context('when there was no prior approval', function () { beforeEach(async function () { - ({ logs } = await this.token.approve(constants.ZERO_ADDRESS, tokenId, { from: owner })); + ({ logs } = await this.token.approve(ZERO_ADDRESS, tokenId, { from: owner })); }); itClearsApproval(); - itEmitsApprovalEvent(constants.ZERO_ADDRESS); + itEmitsApprovalEvent(ZERO_ADDRESS); }); context('when there was a prior approval', function () { beforeEach(async function () { await this.token.approve(approved, tokenId, { from: owner }); - ({ logs } = await this.token.approve(constants.ZERO_ADDRESS, tokenId, { from: owner })); + ({ logs } = await this.token.approve(ZERO_ADDRESS, tokenId, { from: owner })); }); itClearsApproval(); - itEmitsApprovalEvent(constants.ZERO_ADDRESS); + itEmitsApprovalEvent(ZERO_ADDRESS); }); }); diff --git a/test/token/ERC721/ERC721.test.js b/test/token/ERC721/ERC721.test.js index 21d347098..428f313fc 100644 --- a/test/token/ERC721/ERC721.test.js +++ b/test/token/ERC721/ERC721.test.js @@ -1,4 +1,5 @@ const { BN, constants, expectEvent, shouldFail } = require('openzeppelin-test-helpers'); +const { ZERO_ADDRESS } = constants; const { shouldBehaveLikeERC721 } = require('./ERC721.behavior'); const ERC721Mock = artifacts.require('ERC721Mock.sol'); @@ -15,7 +16,7 @@ contract('ERC721', function ([_, creator, tokenOwner, anyone, ...accounts]) { describe('_mint(address, uint256)', function () { it('reverts with a null destination address', async function () { - await shouldFail.reverting(this.token.mint(constants.ZERO_ADDRESS, tokenId)); + await shouldFail.reverting(this.token.mint(ZERO_ADDRESS, tokenId)); }); context('with minted token', async function () { @@ -24,7 +25,7 @@ contract('ERC721', function ([_, creator, tokenOwner, anyone, ...accounts]) { }); it('emits a Transfer event', function () { - expectEvent.inLogs(this.logs, 'Transfer', { from: constants.ZERO_ADDRESS, to: tokenOwner, tokenId }); + expectEvent.inLogs(this.logs, 'Transfer', { from: ZERO_ADDRESS, to: tokenOwner, tokenId }); }); it('creates the token', async function () { @@ -58,7 +59,7 @@ contract('ERC721', function ([_, creator, tokenOwner, anyone, ...accounts]) { }); it('emits a Transfer event', function () { - expectEvent.inLogs(this.logs, 'Transfer', { from: tokenOwner, to: constants.ZERO_ADDRESS, tokenId }); + expectEvent.inLogs(this.logs, 'Transfer', { from: tokenOwner, to: ZERO_ADDRESS, tokenId }); }); it('deletes the token', async function () { @@ -89,7 +90,7 @@ contract('ERC721', function ([_, creator, tokenOwner, anyone, ...accounts]) { }); it('emits a Transfer event', function () { - expectEvent.inLogs(this.logs, 'Transfer', { from: tokenOwner, to: constants.ZERO_ADDRESS, tokenId }); + expectEvent.inLogs(this.logs, 'Transfer', { from: tokenOwner, to: ZERO_ADDRESS, tokenId }); }); it('deletes the token', async function () { diff --git a/test/token/ERC721/ERC721MintBurn.behavior.js b/test/token/ERC721/ERC721MintBurn.behavior.js index b89225cc3..5850faecd 100644 --- a/test/token/ERC721/ERC721MintBurn.behavior.js +++ b/test/token/ERC721/ERC721MintBurn.behavior.js @@ -1,4 +1,5 @@ const { BN, constants, expectEvent, shouldFail } = require('openzeppelin-test-helpers'); +const { ZERO_ADDRESS } = constants; function shouldBehaveLikeMintAndBurnERC721 ( creator, @@ -36,7 +37,7 @@ function shouldBehaveLikeMintAndBurnERC721 ( it('emits a transfer and minted event', async function () { expectEvent.inLogs(logs, 'Transfer', { - from: constants.ZERO_ADDRESS, + from: ZERO_ADDRESS, to: newOwner, tokenId: thirdTokenId, }); @@ -45,7 +46,7 @@ function shouldBehaveLikeMintAndBurnERC721 ( describe('when the given owner address is the zero address', function () { it('reverts', async function () { - await shouldFail.reverting(this.token.mint(constants.ZERO_ADDRESS, thirdTokenId, { from: minter })); + await shouldFail.reverting(this.token.mint(ZERO_ADDRESS, thirdTokenId, { from: minter })); }); }); @@ -82,7 +83,7 @@ function shouldBehaveLikeMintAndBurnERC721 ( it('emits a burn event', async function () { expectEvent.inLogs(logs, 'Transfer', { from: owner, - to: constants.ZERO_ADDRESS, + to: ZERO_ADDRESS, tokenId: tokenId, }); }); diff --git a/test/token/ERC721/ERC721PausedToken.behavior.js b/test/token/ERC721/ERC721PausedToken.behavior.js index 3f1052b71..59ed060c1 100644 --- a/test/token/ERC721/ERC721PausedToken.behavior.js +++ b/test/token/ERC721/ERC721PausedToken.behavior.js @@ -1,4 +1,5 @@ const { BN, constants, shouldFail } = require('openzeppelin-test-helpers'); +const { ZERO_ADDRESS } = constants; function shouldBehaveLikeERC721PausedToken (owner, [recipient, operator]) { const firstTokenId = new BN(1); @@ -35,7 +36,7 @@ function shouldBehaveLikeERC721PausedToken (owner, [recipient, operator]) { describe('getApproved', function () { it('returns approved address', async function () { const approvedAccount = await this.token.getApproved(firstTokenId); - approvedAccount.should.be.equal(constants.ZERO_ADDRESS); + approvedAccount.should.be.equal(ZERO_ADDRESS); }); });