Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ The following provides visibility into how OpenZeppelin's contracts are organize
- **ERC20** - A standard interface for fungible tokens:
- *Interfaces* - Includes the ERC-20 token standard basic interface. I.e., what the contract’s ABI can represent.
- *Implementations* - Includes ERC-20 token implementations that include all required and some optional ERC-20 functionality.
- **ERC721** - A standard interface for non-fungible tokens
- **ERC721** - A standard interface for non-fungible tokens
- *Interfaces* - Includes the ERC-721 token standard basic interface. I.e., what the contract’s ABI can represent.
- *Implementations* - Includes ERC-721 token implementations that include all required and some optional ERC-721 functionality.

Expand Down
5 changes: 0 additions & 5 deletions test/.eslintrc

This file was deleted.

2 changes: 1 addition & 1 deletion test/Bounty.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ contract('Bounty', function ([_, owner, researcher, nonTarget]) {
await this.bounty.claim(this.targetAddress, { from: researcher });
const claim = await this.bounty.claimed();

claim.should.eq(true);
claim.should.equal(true);

const researcherPrevBalance = await ethGetBalance(researcher);

Expand Down
24 changes: 12 additions & 12 deletions test/Heritable.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ contract('Heritable', function ([_, owner, heir, anyone]) {

it('owner can remove heir', async function () {
await heritable.setHeir(heir, { from: owner });
(await heritable.heir()).should.eq(heir);
(await heritable.heir()).should.equal(heir);

await heritable.removeHeir({ from: owner });
(await heritable.heir()).should.eq(NULL_ADDRESS);
(await heritable.heir()).should.equal(NULL_ADDRESS);
});

it('heir can claim ownership only if owner is dead and timeout was reached', async function () {
Expand All @@ -54,7 +54,7 @@ contract('Heritable', function ([_, owner, heir, anyone]) {

await increaseTime(heartbeatTimeout);
await heritable.claimHeirOwnership({ from: heir });
(await heritable.heir()).should.eq(heir);
(await heritable.heir()).should.equal(heir);
});

it('only heir can proclaim death', async function () {
Expand Down Expand Up @@ -85,29 +85,29 @@ contract('Heritable', function ([_, owner, heir, anyone]) {
const setHeirLogs = (await heritable.setHeir(heir, { from: owner })).logs;
const setHeirEvent = setHeirLogs.find(e => e.event === 'HeirChanged');

setHeirEvent.args.owner.should.eq(owner);
setHeirEvent.args.newHeir.should.eq(heir);
setHeirEvent.args.owner.should.equal(owner);
setHeirEvent.args.newHeir.should.equal(heir);

const heartbeatLogs = (await heritable.heartbeat({ from: owner })).logs;
const heartbeatEvent = heartbeatLogs.find(e => e.event === 'OwnerHeartbeated');

heartbeatEvent.args.owner.should.eq(owner);
heartbeatEvent.args.owner.should.equal(owner);

const proclaimDeathLogs = (await heritable.proclaimDeath({ from: heir })).logs;
const ownerDeadEvent = proclaimDeathLogs.find(e => e.event === 'OwnerProclaimedDead');

ownerDeadEvent.args.owner.should.eq(owner);
ownerDeadEvent.args.heir.should.eq(heir);
ownerDeadEvent.args.owner.should.equal(owner);
ownerDeadEvent.args.heir.should.equal(heir);

await increaseTime(heartbeatTimeout);
const claimHeirOwnershipLogs = (await heritable.claimHeirOwnership({ from: heir })).logs;
const ownershipTransferredEvent = claimHeirOwnershipLogs.find(e => e.event === 'OwnershipTransferred');
const heirOwnershipClaimedEvent = claimHeirOwnershipLogs.find(e => e.event === 'HeirOwnershipClaimed');

ownershipTransferredEvent.args.previousOwner.should.eq(owner);
ownershipTransferredEvent.args.newOwner.should.eq(heir);
heirOwnershipClaimedEvent.args.previousOwner.should.eq(owner);
heirOwnershipClaimedEvent.args.newOwner.should.eq(heir);
ownershipTransferredEvent.args.previousOwner.should.equal(owner);
ownershipTransferredEvent.args.newOwner.should.equal(heir);
heirOwnershipClaimedEvent.args.previousOwner.should.equal(owner);
heirOwnershipClaimedEvent.args.newOwner.should.equal(heir);
});

it('timeOfDeath can be queried', async function () {
Expand Down
32 changes: 16 additions & 16 deletions test/access/SignatureBouncer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ contract('Bouncer', ([_, owner, anyone, bouncerAddress, authorizedUser]) => {

context('management', () => {
it('has a default owner of self', async function () {
(await this.bouncer.owner()).should.eq(owner);
(await this.bouncer.owner()).should.equal(owner);
});

it('allows the owner to add a bouncer', async function () {
await this.bouncer.addBouncer(bouncerAddress, { from: owner });
(await this.bouncer.hasRole(bouncerAddress, this.roleBouncer)).should.eq(true);
(await this.bouncer.hasRole(bouncerAddress, this.roleBouncer)).should.equal(true);
});

it('does not allow adding an invalid address', async function () {
Expand All @@ -39,7 +39,7 @@ contract('Bouncer', ([_, owner, anyone, bouncerAddress, authorizedUser]) => {
await this.bouncer.addBouncer(bouncerAddress, { from: owner });

await this.bouncer.removeBouncer(bouncerAddress, { from: owner });
(await this.bouncer.hasRole(bouncerAddress, this.roleBouncer)).should.eq(false);
(await this.bouncer.hasRole(bouncerAddress, this.roleBouncer)).should.equal(false);
});

it('does not allow anyone to add a bouncer', async function () {
Expand Down Expand Up @@ -168,77 +168,77 @@ contract('Bouncer', ([_, owner, anyone, bouncerAddress, authorizedUser]) => {
context('signature validation', () => {
context('plain signature', () => {
it('validates valid signature for valid user', async function () {
(await this.bouncer.checkValidSignature(authorizedUser, this.signFor(authorizedUser))).should.eq(true);
(await this.bouncer.checkValidSignature(authorizedUser, this.signFor(authorizedUser))).should.equal(true);
});

it('does not validate invalid signature for valid user', async function () {
(await this.bouncer.checkValidSignature(authorizedUser, INVALID_SIGNATURE)).should.eq(false);
(await this.bouncer.checkValidSignature(authorizedUser, INVALID_SIGNATURE)).should.equal(false);
});

it('does not validate valid signature for anyone', async function () {
(await this.bouncer.checkValidSignature(anyone, this.signFor(authorizedUser))).should.eq(false);
(await this.bouncer.checkValidSignature(anyone, this.signFor(authorizedUser))).should.equal(false);
});

it('does not validate valid signature for method for valid user', async function () {
(await this.bouncer.checkValidSignature(authorizedUser, this.signFor(authorizedUser, 'checkValidSignature'))
).should.eq(false);
).should.equal(false);
});
});

context('method signature', () => {
it('validates valid signature with correct method for valid user', async function () {
(await this.bouncer.checkValidSignatureAndMethod(authorizedUser,
this.signFor(authorizedUser, 'checkValidSignatureAndMethod'))
).should.eq(true);
).should.equal(true);
});

it('does not validate invalid signature with correct method for valid user', async function () {
(await this.bouncer.checkValidSignatureAndMethod(authorizedUser, INVALID_SIGNATURE)).should.eq(false);
(await this.bouncer.checkValidSignatureAndMethod(authorizedUser, INVALID_SIGNATURE)).should.equal(false);
});

it('does not validate valid signature with correct method for anyone', async function () {
(await this.bouncer.checkValidSignatureAndMethod(anyone,
this.signFor(authorizedUser, 'checkValidSignatureAndMethod'))
).should.eq(false);
).should.equal(false);
});

it('does not validate valid non-method signature with correct method for valid user', async function () {
(await this.bouncer.checkValidSignatureAndMethod(authorizedUser, this.signFor(authorizedUser))
).should.eq(false);
).should.equal(false);
});
});

context('method and data signature', () => {
it('validates valid signature with correct method and data for valid user', async function () {
(await this.bouncer.checkValidSignatureAndData(authorizedUser, BYTES_VALUE, UINT_VALUE,
this.signFor(authorizedUser, 'checkValidSignatureAndData', [authorizedUser, BYTES_VALUE, UINT_VALUE]))
).should.eq(true);
).should.equal(true);
});

it('does not validate invalid signature with correct method and data for valid user', async function () {
(await this.bouncer.checkValidSignatureAndData(authorizedUser, BYTES_VALUE, UINT_VALUE, INVALID_SIGNATURE)
).should.eq(false);
).should.equal(false);
});

it('does not validate valid signature with correct method and incorrect data for valid user',
async function () {
(await this.bouncer.checkValidSignatureAndData(authorizedUser, BYTES_VALUE, UINT_VALUE + 10,
this.signFor(authorizedUser, 'checkValidSignatureAndData', [authorizedUser, BYTES_VALUE, UINT_VALUE]))
).should.eq(false);
).should.equal(false);
}
);

it('does not validate valid signature with correct method and data for anyone', async function () {
(await this.bouncer.checkValidSignatureAndData(anyone, BYTES_VALUE, UINT_VALUE,
this.signFor(authorizedUser, 'checkValidSignatureAndData', [authorizedUser, BYTES_VALUE, UINT_VALUE]))
).should.eq(false);
).should.equal(false);
});

it('does not validate valid non-method-data signature with correct method and data for valid user',
async function () {
(await this.bouncer.checkValidSignatureAndData(authorizedUser, BYTES_VALUE, UINT_VALUE,
this.signFor(authorizedUser, 'checkValidSignatureAndData'))
).should.eq(false);
).should.equal(false);
}
);
});
Expand Down
4 changes: 2 additions & 2 deletions test/crowdsale/AllowanceCrowdsale.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ contract('AllowanceCrowdsale', function ([_, investor, wallet, purchaser, tokenW
const { logs } = await this.crowdsale.sendTransaction({ value: value, from: investor });
const event = logs.find(e => e.event === 'TokenPurchase');
should.exist(event);
event.args.purchaser.should.eq(investor);
event.args.beneficiary.should.eq(investor);
event.args.purchaser.should.equal(investor);
event.args.beneficiary.should.equal(investor);
event.args.value.should.be.bignumber.equal(value);
event.args.amount.should.be.bignumber.equal(expectedTokenAmount);
});
Expand Down
6 changes: 3 additions & 3 deletions test/crowdsale/CappedCrowdsale.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,17 @@ contract('CappedCrowdsale', function ([_, wallet]) {
describe('ending', function () {
it('should not reach cap if sent under cap', async function () {
await this.crowdsale.send(lessThanCap);
(await this.crowdsale.capReached()).should.be.false;
(await this.crowdsale.capReached()).should.equal(false);
});

it('should not reach cap if sent just under cap', async function () {
await this.crowdsale.send(cap.minus(1));
(await this.crowdsale.capReached()).should.be.false;
(await this.crowdsale.capReached()).should.equal(false);
});

it('should reach cap if cap sent', async function () {
await this.crowdsale.send(cap);
(await this.crowdsale.capReached()).should.be.true;
(await this.crowdsale.capReached()).should.equal(true);
});
});
});
8 changes: 4 additions & 4 deletions test/crowdsale/Crowdsale.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ contract('Crowdsale', function ([_, investor, wallet, purchaser]) {
const { logs } = await this.crowdsale.sendTransaction({ value: value, from: investor });
const event = logs.find(e => e.event === 'TokenPurchase');
should.exist(event);
event.args.purchaser.should.eq(investor);
event.args.beneficiary.should.eq(investor);
event.args.purchaser.should.equal(investor);
event.args.beneficiary.should.equal(investor);
event.args.value.should.be.bignumber.equal(value);
event.args.amount.should.be.bignumber.equal(expectedTokenAmount);
});
Expand All @@ -108,8 +108,8 @@ contract('Crowdsale', function ([_, investor, wallet, purchaser]) {
const { logs } = await this.crowdsale.buyTokens(investor, { value: value, from: purchaser });
const event = logs.find(e => e.event === 'TokenPurchase');
should.exist(event);
event.args.purchaser.should.eq(purchaser);
event.args.beneficiary.should.eq(investor);
event.args.purchaser.should.equal(purchaser);
event.args.beneficiary.should.equal(investor);
event.args.value.should.be.bignumber.equal(value);
event.args.amount.should.be.bignumber.equal(expectedTokenAmount);
});
Expand Down
4 changes: 2 additions & 2 deletions test/crowdsale/MintedCrowdsale.behavior.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ function shouldBehaveLikeMintedCrowdsale ([_, investor, wallet, purchaser], rate
const { logs } = await this.crowdsale.sendTransaction({ value: value, from: investor });
const event = logs.find(e => e.event === 'TokenPurchase');
should.exist(event);
event.args.purchaser.should.eq(investor);
event.args.beneficiary.should.eq(investor);
event.args.purchaser.should.equal(investor);
event.args.beneficiary.should.equal(investor);
event.args.value.should.be.bignumber.equal(value);
event.args.amount.should.be.bignumber.equal(expectedTokenAmount);
});
Expand Down
4 changes: 2 additions & 2 deletions test/crowdsale/MintedCrowdsale.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ contract('MintedCrowdsale', function ([_, investor, wallet, purchaser]) {
});

it('should be token owner', async function () {
(await this.token.owner()).should.eq(this.crowdsale.address);
(await this.token.owner()).should.equal(this.crowdsale.address);
});

shouldBehaveLikeMintedCrowdsale([_, investor, wallet, purchaser], rate, value);
Expand All @@ -35,7 +35,7 @@ contract('MintedCrowdsale', function ([_, investor, wallet, purchaser]) {
});

it('should have minter role on token', async function () {
(await this.token.hasRole(this.crowdsale.address, ROLE_MINTER)).should.be.true;
(await this.token.hasRole(this.crowdsale.address, ROLE_MINTER)).should.equal(true);
});

shouldBehaveLikeMintedCrowdsale([_, investor, wallet, purchaser], rate, value);
Expand Down
4 changes: 2 additions & 2 deletions test/crowdsale/TimedCrowdsale.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ contract('TimedCrowdsale', function ([_, investor, wallet, purchaser]) {
});

it('should be ended only after end', async function () {
(await this.crowdsale.hasClosed()).should.be.false;
(await this.crowdsale.hasClosed()).should.equal(false);
await increaseTimeTo(this.afterClosingTime);
(await this.crowdsale.hasClosed()).should.be.true;
(await this.crowdsale.hasClosed()).should.equal(true);
});

describe('accepting payments', function () {
Expand Down
10 changes: 5 additions & 5 deletions test/crowdsale/WhitelistedCrowdsale.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ contract('WhitelistedCrowdsale', function ([_, wallet, authorized, unauthorized,

describe('reporting whitelisted', function () {
it('should correctly report whitelisted addresses', async function () {
(await this.crowdsale.whitelist(authorized)).should.be.true;
(await this.crowdsale.whitelist(unauthorized)).should.be.false;
(await this.crowdsale.whitelist(authorized)).should.equal(true);
(await this.crowdsale.whitelist(unauthorized)).should.equal(false);
});
});
});
Expand Down Expand Up @@ -80,9 +80,9 @@ contract('WhitelistedCrowdsale', function ([_, wallet, authorized, unauthorized,

describe('reporting whitelisted', function () {
it('should correctly report whitelisted addresses', async function () {
(await this.crowdsale.whitelist(authorized)).should.be.true;
(await this.crowdsale.whitelist(anotherAuthorized)).should.be.true;
(await this.crowdsale.whitelist(unauthorized)).should.be.false;
(await this.crowdsale.whitelist(authorized)).should.equal(true);
(await this.crowdsale.whitelist(anotherAuthorized)).should.equal(true);
(await this.crowdsale.whitelist(unauthorized)).should.equal(false);
});
});
});
Expand Down
6 changes: 3 additions & 3 deletions test/examples/SampleCrowdsale.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const { ethGetBalance } = require('../helpers/web3');

const BigNumber = web3.BigNumber;

require('chai')
const should = require('chai')
.use(require('chai-bignumber')(BigNumber))
.should();

Expand Down Expand Up @@ -40,8 +40,8 @@ contract('SampleCrowdsale', function ([_, owner, wallet, investor]) {
});

it('should create crowdsale with correct parameters', async function () {
this.crowdsale.should.exist;
this.token.should.exist;
should.exist(this.crowdsale);
should.exist(this.token);

(await this.crowdsale.openingTime()).should.be.bignumber.equal(this.openingTime);
(await this.crowdsale.closingTime()).should.be.bignumber.equal(this.closingTime);
Expand Down
6 changes: 3 additions & 3 deletions test/examples/SimpleToken.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ contract('SimpleToken', function ([_, creator]) {
});

it('has a name', async function () {
(await token.name()).should.eq('SimpleToken');
(await token.name()).should.equal('SimpleToken');
});

it('has a symbol', async function () {
(await token.symbol()).should.eq('SIM');
(await token.symbol()).should.equal('SIM');
});

it('has 18 decimals', async function () {
Expand All @@ -36,7 +36,7 @@ contract('SimpleToken', function ([_, creator]) {

const receipt = await web3.eth.getTransactionReceipt(token.transactionHash);
const logs = decodeLogs(receipt.logs, SimpleToken, token.address);
logs.length.should.eq(1);
logs.length.should.equal(1);
logs[0].event.should.equal('Transfer');
logs[0].args.from.valueOf().should.equal(ZERO_ADDRESS);
logs[0].args.to.valueOf().should.equal(creator);
Expand Down
2 changes: 1 addition & 1 deletion test/helpers/expectEvent.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function inLogs (logs, eventName, eventArgs = {}) {
should.exist(event);
for (const [k, v] of Object.entries(eventArgs)) {
should.exist(event.args[k]);
event.args[k].should.eq(v);
event.args[k].should.equal(v);
}
return event;
}
Expand Down
2 changes: 1 addition & 1 deletion test/introspection/SupportsInterface.behavior.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function shouldSupportInterfaces (interfaces = []) {
});

it('is supported', async function () {
(await this.thing.supportsInterface(interfaceId)).should.be.true;
(await this.thing.supportsInterface(interfaceId)).should.equal(true);
});
});
}
Expand Down
Loading