* replacing all instances of from: anyone with from: other * replacing all instances of from: anyone with from: other * replacing all instances of from: anyone with from: other * changing anyone to other * changing anyone to other
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
const { shouldFail } = require('openzeppelin-test-helpers');
|
||||
|
||||
function shouldBehaveLikeERC20Capped (minter, [anyone], cap) {
|
||||
function shouldBehaveLikeERC20Capped (minter, [other], cap) {
|
||||
describe('capped token', function () {
|
||||
const from = minter;
|
||||
|
||||
@ -9,18 +9,18 @@ function shouldBehaveLikeERC20Capped (minter, [anyone], cap) {
|
||||
});
|
||||
|
||||
it('should mint when amount is less than cap', async function () {
|
||||
await this.token.mint(anyone, cap.subn(1), { from });
|
||||
await this.token.mint(other, cap.subn(1), { from });
|
||||
(await this.token.totalSupply()).should.be.bignumber.equal(cap.subn(1));
|
||||
});
|
||||
|
||||
it('should fail to mint if the amount exceeds the cap', async function () {
|
||||
await this.token.mint(anyone, cap.subn(1), { from });
|
||||
await shouldFail.reverting(this.token.mint(anyone, 2, { from }));
|
||||
await this.token.mint(other, cap.subn(1), { from });
|
||||
await shouldFail.reverting(this.token.mint(other, 2, { from }));
|
||||
});
|
||||
|
||||
it('should fail to mint after cap is reached', async function () {
|
||||
await this.token.mint(anyone, cap, { from });
|
||||
await shouldFail.reverting(this.token.mint(anyone, 1, { from }));
|
||||
await this.token.mint(other, cap, { from });
|
||||
await shouldFail.reverting(this.token.mint(other, 1, { from }));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
const { BN, constants, expectEvent, shouldFail } = require('openzeppelin-test-helpers');
|
||||
const { ZERO_ADDRESS } = constants;
|
||||
|
||||
function shouldBehaveLikeERC20Mintable (minter, [anyone]) {
|
||||
function shouldBehaveLikeERC20Mintable (minter, [other]) {
|
||||
describe('as a mintable token', function () {
|
||||
describe('mint', function () {
|
||||
const amount = new BN(100);
|
||||
@ -19,17 +19,17 @@ function shouldBehaveLikeERC20Mintable (minter, [anyone]) {
|
||||
|
||||
function shouldMint (amount) {
|
||||
beforeEach(async function () {
|
||||
({ logs: this.logs } = await this.token.mint(anyone, amount, { from }));
|
||||
({ logs: this.logs } = await this.token.mint(other, amount, { from }));
|
||||
});
|
||||
|
||||
it('mints the requested amount', async function () {
|
||||
(await this.token.balanceOf(anyone)).should.be.bignumber.equal(amount);
|
||||
(await this.token.balanceOf(other)).should.be.bignumber.equal(amount);
|
||||
});
|
||||
|
||||
it('emits a mint and a transfer event', async function () {
|
||||
expectEvent.inLogs(this.logs, 'Transfer', {
|
||||
from: ZERO_ADDRESS,
|
||||
to: anyone,
|
||||
to: other,
|
||||
value: amount,
|
||||
});
|
||||
});
|
||||
@ -37,10 +37,10 @@ function shouldBehaveLikeERC20Mintable (minter, [anyone]) {
|
||||
});
|
||||
|
||||
context('when the sender doesn\'t have minting permission', function () {
|
||||
const from = anyone;
|
||||
const from = other;
|
||||
|
||||
it('reverts', async function () {
|
||||
await shouldFail.reverting(this.token.mint(anyone, amount, { from }));
|
||||
await shouldFail.reverting(this.token.mint(other, amount, { from }));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -7,7 +7,7 @@ const ERC721ReceiverMock = artifacts.require('ERC721ReceiverMock.sol');
|
||||
function shouldBehaveLikeERC721 (
|
||||
creator,
|
||||
minter,
|
||||
[owner, approved, anotherApproved, operator, anyone]
|
||||
[owner, approved, anotherApproved, operator, other]
|
||||
) {
|
||||
const firstTokenId = new BN(1);
|
||||
const secondTokenId = new BN(2);
|
||||
@ -18,7 +18,7 @@ function shouldBehaveLikeERC721 (
|
||||
beforeEach(async function () {
|
||||
await this.token.mint(owner, firstTokenId, { from: minter });
|
||||
await this.token.mint(owner, secondTokenId, { from: minter });
|
||||
this.toWhom = anyone; // default to anyone for toWhom in context-dependent tests
|
||||
this.toWhom = other; // default to anyone for toWhom in context-dependent tests
|
||||
});
|
||||
|
||||
describe('balanceOf', function () {
|
||||
@ -30,7 +30,7 @@ function shouldBehaveLikeERC721 (
|
||||
|
||||
context('when the given address does not own any tokens', function () {
|
||||
it('returns 0', async function () {
|
||||
(await this.token.balanceOf(anyone)).should.be.bignumber.equal('0');
|
||||
(await this.token.balanceOf(other)).should.be.bignumber.equal('0');
|
||||
});
|
||||
});
|
||||
|
||||
@ -178,21 +178,21 @@ function shouldBehaveLikeERC721 (
|
||||
|
||||
context('when the address of the previous owner is incorrect', function () {
|
||||
it('reverts', async function () {
|
||||
await shouldFail.reverting(transferFunction.call(this, anyone, anyone, tokenId, { from: owner })
|
||||
await shouldFail.reverting(transferFunction.call(this, other, other, tokenId, { from: owner })
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
context('when the sender is not authorized for the token id', function () {
|
||||
it('reverts', async function () {
|
||||
await shouldFail.reverting(transferFunction.call(this, owner, anyone, tokenId, { from: anyone })
|
||||
await shouldFail.reverting(transferFunction.call(this, owner, other, tokenId, { from: other })
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
context('when the given token ID does not exist', function () {
|
||||
it('reverts', async function () {
|
||||
await shouldFail.reverting(transferFunction.call(this, owner, anyone, unknownTokenId, { from: owner })
|
||||
await shouldFail.reverting(transferFunction.call(this, owner, other, unknownTokenId, { from: owner })
|
||||
);
|
||||
});
|
||||
});
|
||||
@ -398,7 +398,7 @@ function shouldBehaveLikeERC721 (
|
||||
|
||||
context('when the sender does not own the given token ID', function () {
|
||||
it('reverts', async function () {
|
||||
await shouldFail.reverting(this.token.approve(approved, tokenId, { from: anyone }));
|
||||
await shouldFail.reverting(this.token.approve(approved, tokenId, { from: other }));
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@ const { ZERO_ADDRESS } = constants;
|
||||
const { shouldBehaveLikeERC721 } = require('./ERC721.behavior');
|
||||
const ERC721Mock = artifacts.require('ERC721Mock.sol');
|
||||
|
||||
contract('ERC721', function ([_, creator, tokenOwner, anyone, ...accounts]) {
|
||||
contract('ERC721', function ([_, creator, tokenOwner, other, ...accounts]) {
|
||||
beforeEach(async function () {
|
||||
this.token = await ERC721Mock.new({ from: creator });
|
||||
});
|
||||
@ -50,7 +50,7 @@ contract('ERC721', function ([_, creator, tokenOwner, anyone, ...accounts]) {
|
||||
});
|
||||
|
||||
it('reverts when the account is not the owner', async function () {
|
||||
await shouldFail.reverting(this.token.methods['burn(address,uint256)'](anyone, tokenId));
|
||||
await shouldFail.reverting(this.token.methods['burn(address,uint256)'](other, tokenId));
|
||||
});
|
||||
|
||||
context('with burnt token', function () {
|
||||
|
||||
@ -4,7 +4,7 @@ const { ZERO_ADDRESS } = constants;
|
||||
function shouldBehaveLikeMintAndBurnERC721 (
|
||||
creator,
|
||||
minter,
|
||||
[owner, newOwner, approved, anyone]
|
||||
[owner, newOwner, approved, other]
|
||||
) {
|
||||
const firstTokenId = new BN(1);
|
||||
const secondTokenId = new BN(2);
|
||||
|
||||
Reference in New Issue
Block a user