Browse Source

Add Mock suffix to variable names #1172 (#1324)

* Add Mock suffix to variable names #1172

* Add Impl suffix to variable names
Martín 7 years ago
parent
commit
4b21fcf5af

+ 2 - 2
test/Counter.test.js

@@ -1,5 +1,5 @@
 
-const Counter = artifacts.require('CounterImpl');
+const CounterImpl = artifacts.require('CounterImpl');
 
 require('chai')
   .use(require('chai-bignumber')(web3.BigNumber))
@@ -11,7 +11,7 @@ const KEY2 = web3.sha3('key2');
 
 contract('Counter', function ([_, owner]) {
   beforeEach(async function () {
-    this.mock = await Counter.new({ from: owner });
+    this.mock = await CounterImpl.new({ from: owner });
   });
 
   context('custom key', async function () {

+ 3 - 3
test/crowdsale/AllowanceCrowdsale.test.js

@@ -8,7 +8,7 @@ const should = require('chai')
   .use(require('chai-bignumber')(BigNumber))
   .should();
 
-const AllowanceCrowdsale = artifacts.require('AllowanceCrowdsaleImpl');
+const AllowanceCrowdsaleImpl = artifacts.require('AllowanceCrowdsaleImpl');
 const SimpleToken = artifacts.require('SimpleToken');
 
 contract('AllowanceCrowdsale', function ([_, investor, wallet, purchaser, tokenWallet]) {
@@ -20,7 +20,7 @@ contract('AllowanceCrowdsale', function ([_, investor, wallet, purchaser, tokenW
 
   beforeEach(async function () {
     this.token = await SimpleToken.new({ from: tokenWallet });
-    this.crowdsale = await AllowanceCrowdsale.new(rate, wallet, this.token.address, tokenWallet);
+    this.crowdsale = await AllowanceCrowdsaleImpl.new(rate, wallet, this.token.address, tokenWallet);
     await this.token.approve(this.crowdsale.address, tokenAllowance, { from: tokenWallet });
   });
 
@@ -73,7 +73,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 assertRevert(AllowanceCrowdsale.new(rate, wallet, this.token.address, ZERO_ADDRESS));
+      await assertRevert(AllowanceCrowdsaleImpl.new(rate, wallet, this.token.address, ZERO_ADDRESS));
     });
   });
 });

+ 3 - 3
test/crowdsale/CappedCrowdsale.test.js

@@ -8,7 +8,7 @@ require('chai')
   .use(require('chai-bignumber')(BigNumber))
   .should();
 
-const CappedCrowdsale = artifacts.require('CappedCrowdsaleImpl');
+const CappedCrowdsaleImpl = artifacts.require('CappedCrowdsaleImpl');
 const SimpleToken = artifacts.require('SimpleToken');
 
 contract('CappedCrowdsale', function ([_, wallet]) {
@@ -23,14 +23,14 @@ contract('CappedCrowdsale', function ([_, wallet]) {
 
   it('rejects a cap of zero', async function () {
     await expectThrow(
-      CappedCrowdsale.new(rate, wallet, this.token.address, 0),
+      CappedCrowdsaleImpl.new(rate, wallet, this.token.address, 0),
       EVMRevert,
     );
   });
 
   context('with crowdsale', function () {
     beforeEach(async function () {
-      this.crowdsale = await CappedCrowdsale.new(rate, wallet, this.token.address, cap);
+      this.crowdsale = await CappedCrowdsaleImpl.new(rate, wallet, this.token.address, cap);
       await this.token.transfer(this.crowdsale.address, tokenSupply);
     });
 

+ 2 - 2
test/crowdsale/FinalizableCrowdsale.test.js

@@ -10,7 +10,7 @@ const should = require('chai')
   .use(require('chai-bignumber')(BigNumber))
   .should();
 
-const FinalizableCrowdsale = artifacts.require('FinalizableCrowdsaleImpl');
+const FinalizableCrowdsaleImpl = artifacts.require('FinalizableCrowdsaleImpl');
 const ERC20 = artifacts.require('ERC20');
 
 contract('FinalizableCrowdsale', function ([_, wallet, anyone]) {
@@ -27,7 +27,7 @@ contract('FinalizableCrowdsale', function ([_, wallet, anyone]) {
     this.afterClosingTime = this.closingTime + duration.seconds(1);
 
     this.token = await ERC20.new();
-    this.crowdsale = await FinalizableCrowdsale.new(
+    this.crowdsale = await FinalizableCrowdsaleImpl.new(
       this.openingTime, this.closingTime, rate, wallet, this.token.address
     );
   });

+ 4 - 4
test/crowdsale/IncreasingPriceCrowdsale.test.js

@@ -10,7 +10,7 @@ require('chai')
   .use(require('chai-bignumber')(BigNumber))
   .should();
 
-const IncreasingPriceCrowdsale = artifacts.require('IncreasingPriceCrowdsaleImpl');
+const IncreasingPriceCrowdsaleImpl = artifacts.require('IncreasingPriceCrowdsaleImpl');
 const SimpleToken = artifacts.require('SimpleToken');
 
 contract('IncreasingPriceCrowdsale', function ([_, investor, wallet, purchaser]) {
@@ -36,20 +36,20 @@ contract('IncreasingPriceCrowdsale', function ([_, investor, wallet, purchaser])
     });
 
     it('rejects a final rate larger than the initial rate', async function () {
-      await assertRevert(IncreasingPriceCrowdsale.new(
+      await assertRevert(IncreasingPriceCrowdsaleImpl.new(
         this.startTime, this.closingTime, wallet, this.token.address, initialRate, initialRate.plus(1)
       ));
     });
 
     it('rejects a final rate of zero', async function () {
-      await assertRevert(IncreasingPriceCrowdsale.new(
+      await assertRevert(IncreasingPriceCrowdsaleImpl.new(
         this.startTime, this.closingTime, wallet, this.token.address, initialRate, 0
       ));
     });
 
     context('with crowdsale', function () {
       beforeEach(async function () {
-        this.crowdsale = await IncreasingPriceCrowdsale.new(
+        this.crowdsale = await IncreasingPriceCrowdsaleImpl.new(
           this.startTime, this.closingTime, wallet, this.token.address, initialRate, finalRate
         );
         await this.token.transfer(this.crowdsale.address, tokenSupply);

+ 3 - 3
test/crowdsale/MintedCrowdsale.test.js

@@ -4,7 +4,7 @@ const { assertRevert } = require('../helpers/assertRevert');
 
 const BigNumber = web3.BigNumber;
 
-const MintedCrowdsale = artifacts.require('MintedCrowdsaleImpl');
+const MintedCrowdsaleImpl = artifacts.require('MintedCrowdsaleImpl');
 const ERC20Mintable = artifacts.require('ERC20Mintable');
 const ERC20 = artifacts.require('ERC20');
 
@@ -15,7 +15,7 @@ contract('MintedCrowdsale', function ([_, deployer, investor, wallet, purchaser]
   describe('using ERC20Mintable', function () {
     beforeEach(async function () {
       this.token = await ERC20Mintable.new({ from: deployer });
-      this.crowdsale = await MintedCrowdsale.new(rate, wallet, this.token.address);
+      this.crowdsale = await MintedCrowdsaleImpl.new(rate, wallet, this.token.address);
 
       await this.token.addMinter(this.crowdsale.address, { from: deployer });
       await this.token.renounceMinter({ from: deployer });
@@ -31,7 +31,7 @@ contract('MintedCrowdsale', function ([_, deployer, investor, wallet, purchaser]
   describe('using non-mintable token', function () {
     beforeEach(async function () {
       this.token = await ERC20.new();
-      this.crowdsale = await MintedCrowdsale.new(rate, wallet, this.token.address);
+      this.crowdsale = await MintedCrowdsaleImpl.new(rate, wallet, this.token.address);
     });
 
     it('rejects bare payments', async function () {

+ 2 - 2
test/crowdsale/PostDeliveryCrowdsale.test.js

@@ -11,7 +11,7 @@ require('chai')
   .use(require('chai-bignumber')(BigNumber))
   .should();
 
-const PostDeliveryCrowdsale = artifacts.require('PostDeliveryCrowdsaleImpl');
+const PostDeliveryCrowdsaleImpl = artifacts.require('PostDeliveryCrowdsaleImpl');
 const SimpleToken = artifacts.require('SimpleToken');
 
 contract('PostDeliveryCrowdsale', function ([_, investor, wallet, purchaser]) {
@@ -28,7 +28,7 @@ contract('PostDeliveryCrowdsale', function ([_, investor, wallet, purchaser]) {
     this.closingTime = this.openingTime + duration.weeks(1);
     this.afterClosingTime = this.closingTime + duration.seconds(1);
     this.token = await SimpleToken.new();
-    this.crowdsale = await PostDeliveryCrowdsale.new(
+    this.crowdsale = await PostDeliveryCrowdsaleImpl.new(
       this.openingTime, this.closingTime, rate, wallet, this.token.address
     );
     await this.token.transfer(this.crowdsale.address, tokenSupply);

+ 3 - 3
test/crowdsale/RefundableCrowdsale.test.js

@@ -12,7 +12,7 @@ require('chai')
   .use(require('chai-bignumber')(BigNumber))
   .should();
 
-const RefundableCrowdsale = artifacts.require('RefundableCrowdsaleImpl');
+const RefundableCrowdsaleImpl = artifacts.require('RefundableCrowdsaleImpl');
 const SimpleToken = artifacts.require('SimpleToken');
 
 contract('RefundableCrowdsale', function ([_, wallet, investor, purchaser, anyone]) {
@@ -37,7 +37,7 @@ contract('RefundableCrowdsale', function ([_, wallet, investor, purchaser, anyon
 
   it('rejects a goal of zero', async function () {
     await expectThrow(
-      RefundableCrowdsale.new(
+      RefundableCrowdsaleImpl.new(
         this.openingTime, this.closingTime, rate, wallet, this.token.address, 0,
       ),
       EVMRevert,
@@ -46,7 +46,7 @@ contract('RefundableCrowdsale', function ([_, wallet, investor, purchaser, anyon
 
   context('with crowdsale', function () {
     beforeEach(async function () {
-      this.crowdsale = await RefundableCrowdsale.new(
+      this.crowdsale = await RefundableCrowdsaleImpl.new(
         this.openingTime, this.closingTime, rate, wallet, this.token.address, goal
       );
 

+ 6 - 4
test/crowdsale/TimedCrowdsale.test.js

@@ -11,7 +11,7 @@ require('chai')
   .use(require('chai-bignumber')(BigNumber))
   .should();
 
-const TimedCrowdsale = artifacts.require('TimedCrowdsaleImpl');
+const TimedCrowdsaleImpl = artifacts.require('TimedCrowdsaleImpl');
 const SimpleToken = artifacts.require('SimpleToken');
 
 contract('TimedCrowdsale', function ([_, investor, wallet, purchaser]) {
@@ -32,20 +32,22 @@ contract('TimedCrowdsale', function ([_, investor, wallet, purchaser]) {
   });
 
   it('rejects an opening time in the past', async function () {
-    await expectThrow(TimedCrowdsale.new(
+    await expectThrow(TimedCrowdsaleImpl.new(
       (await latestTime()) - duration.days(1), this.closingTime, rate, wallet, this.token.address
     ), EVMRevert);
   });
 
   it('rejects a closing time before the opening time', async function () {
-    await expectThrow(TimedCrowdsale.new(
+    await expectThrow(TimedCrowdsaleImpl.new(
       this.openingTime, this.openingTime - duration.seconds(1), rate, wallet, this.token.address
     ), EVMRevert);
   });
 
   context('with crowdsale', function () {
     beforeEach(async function () {
-      this.crowdsale = await TimedCrowdsale.new(this.openingTime, this.closingTime, rate, wallet, this.token.address);
+      this.crowdsale = await TimedCrowdsaleImpl.new(
+        this.openingTime, this.closingTime, rate, wallet, this.token.address
+      );
       await this.token.transfer(this.crowdsale.address, tokenSupply);
     });
 

+ 2 - 2
test/drafts/ERC1046/TokenMetadata.test.js

@@ -1,4 +1,4 @@
-const ERC20WithMetadata = artifacts.require('ERC20WithMetadataMock');
+const ERC20WithMetadataMock = artifacts.require('ERC20WithMetadataMock');
 
 require('chai')
   .should();
@@ -7,7 +7,7 @@ const metadataURI = 'https://example.com';
 
 describe('ERC20WithMetadata', function () {
   beforeEach(async function () {
-    this.token = await ERC20WithMetadata.new(metadataURI);
+    this.token = await ERC20WithMetadataMock.new(metadataURI);
   });
 
   it('responds with the metadata', async function () {

+ 2 - 2
test/introspection/ERC165.test.js

@@ -1,14 +1,14 @@
 const { shouldSupportInterfaces } = require('./SupportsInterface.behavior');
 const { assertRevert } = require('../helpers/assertRevert');
 
-const ERC165 = artifacts.require('ERC165Mock');
+const ERC165Mock = artifacts.require('ERC165Mock');
 
 require('chai')
   .should();
 
 contract('ERC165', function () {
   beforeEach(async function () {
-    this.mock = await ERC165.new();
+    this.mock = await ERC165Mock.new();
   });
 
   it('does not allow 0xffffffff', async function () {

+ 2 - 2
test/token/ERC20/ERC20.test.js

@@ -1,7 +1,7 @@
 const { assertRevert } = require('../../helpers/assertRevert');
 const expectEvent = require('../../helpers/expectEvent');
 
-const ERC20 = artifacts.require('ERC20Mock');
+const ERC20Mock = artifacts.require('ERC20Mock');
 
 const BigNumber = web3.BigNumber;
 
@@ -13,7 +13,7 @@ contract('ERC20', function ([_, owner, recipient, anotherAccount]) {
   const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';
 
   beforeEach(async function () {
-    this.token = await ERC20.new(owner, 100);
+    this.token = await ERC20Mock.new(owner, 100);
   });
 
   describe('total supply', function () {

+ 2 - 2
test/token/ERC20/ERC20Pausable.test.js

@@ -1,11 +1,11 @@
 const { assertRevert } = require('../../helpers/assertRevert');
 
-const ERC20Pausable = artifacts.require('ERC20PausableMock');
+const ERC20PausableMock = artifacts.require('ERC20PausableMock');
 const { shouldBehaveLikePublicRole } = require('../../access/roles/PublicRole.behavior');
 
 contract('ERC20Pausable', function ([_, pauser, otherPauser, recipient, anotherAccount, ...otherAccounts]) {
   beforeEach(async function () {
-    this.token = await ERC20Pausable.new(pauser, 100, { from: pauser });
+    this.token = await ERC20PausableMock.new(pauser, 100, { from: pauser });
   });
 
   describe('pauser role', function () {

+ 6 - 6
test/token/ERC721/ERC721.behavior.js

@@ -3,7 +3,7 @@ const { assertRevert } = require('../../helpers/assertRevert');
 const { decodeLogs } = require('../../helpers/decodeLogs');
 const { sendTransaction } = require('../../helpers/sendTransaction');
 
-const ERC721Receiver = artifacts.require('ERC721ReceiverMock.sol');
+const ERC721ReceiverMock = artifacts.require('ERC721ReceiverMock.sol');
 const BigNumber = web3.BigNumber;
 
 require('chai')
@@ -237,7 +237,7 @@ function shouldBehaveLikeERC721 (
 
           describe('to a valid receiver contract', function () {
             beforeEach(async function () {
-              this.receiver = await ERC721Receiver.new(RECEIVER_MAGIC_VALUE, false);
+              this.receiver = await ERC721ReceiverMock.new(RECEIVER_MAGIC_VALUE, false);
               this.toWhom = this.receiver.address;
             });
 
@@ -246,7 +246,7 @@ function shouldBehaveLikeERC721 (
             it('should call onERC721Received', async function () {
               const result = await transferFun.call(this, owner, this.receiver.address, tokenId, { from: owner });
               result.receipt.logs.length.should.be.equal(2);
-              const [log] = decodeLogs([result.receipt.logs[1]], ERC721Receiver, this.receiver.address);
+              const [log] = decodeLogs([result.receipt.logs[1]], ERC721ReceiverMock, this.receiver.address);
               log.event.should.be.equal('Received');
               log.args.operator.should.be.equal(owner);
               log.args.from.should.be.equal(owner);
@@ -261,7 +261,7 @@ function shouldBehaveLikeERC721 (
               result.receipt.logs.length.should.be.equal(2);
               const [log] = decodeLogs(
                 [result.receipt.logs[1]],
-                ERC721Receiver,
+                ERC721ReceiverMock,
                 this.receiver.address
               );
               log.event.should.be.equal('Received');
@@ -297,14 +297,14 @@ function shouldBehaveLikeERC721 (
 
         describe('to a receiver contract returning unexpected value', function () {
           it('reverts', async function () {
-            const invalidReceiver = await ERC721Receiver.new('0x42', false);
+            const invalidReceiver = await ERC721ReceiverMock.new('0x42', false);
             await assertRevert(this.token.safeTransferFrom(owner, invalidReceiver.address, tokenId, { from: owner }));
           });
         });
 
         describe('to a receiver contract that throws', function () {
           it('reverts', async function () {
-            const invalidReceiver = await ERC721Receiver.new(RECEIVER_MAGIC_VALUE, true);
+            const invalidReceiver = await ERC721ReceiverMock.new(RECEIVER_MAGIC_VALUE, true);
             await assertRevert(this.token.safeTransferFrom(owner, invalidReceiver.address, tokenId, { from: owner }));
           });
         });

+ 2 - 2
test/token/ERC721/ERC721.test.js

@@ -1,7 +1,7 @@
 const { shouldBehaveLikeERC721 } = require('./ERC721.behavior');
 
 const BigNumber = web3.BigNumber;
-const ERC721 = artifacts.require('ERC721Mock.sol');
+const ERC721Mock = artifacts.require('ERC721Mock.sol');
 
 require('chai')
   .use(require('chai-bignumber')(BigNumber))
@@ -9,7 +9,7 @@ require('chai')
 
 contract('ERC721', function ([_, creator, ...accounts]) {
   beforeEach(async function () {
-    this.token = await ERC721.new({ from: creator });
+    this.token = await ERC721Mock.new({ from: creator });
   });
 
   shouldBehaveLikeERC721(creator, creator, accounts);

+ 2 - 2
test/token/ERC721/ERC721Burnable.test.js

@@ -4,7 +4,7 @@ const {
 } = require('./ERC721MintBurn.behavior');
 
 const BigNumber = web3.BigNumber;
-const ERC721Burnable = artifacts.require('ERC721MintableBurnableImpl.sol');
+const ERC721BurnableImpl = artifacts.require('ERC721MintableBurnableImpl.sol');
 
 require('chai')
   .use(require('chai-bignumber')(BigNumber))
@@ -14,7 +14,7 @@ contract('ERC721Burnable', function ([_, creator, ...accounts]) {
   const minter = creator;
 
   beforeEach(async function () {
-    this.token = await ERC721Burnable.new({ from: creator });
+    this.token = await ERC721BurnableImpl.new({ from: creator });
   });
 
   shouldBehaveLikeERC721(creator, minter, accounts);

+ 2 - 2
test/token/ERC721/ERC721Mintable.test.js

@@ -4,7 +4,7 @@ const {
 } = require('./ERC721MintBurn.behavior');
 
 const BigNumber = web3.BigNumber;
-const ERC721Mintable = artifacts.require('ERC721MintableBurnableImpl.sol');
+const ERC721MintableImpl = artifacts.require('ERC721MintableBurnableImpl.sol');
 
 require('chai')
   .use(require('chai-bignumber')(BigNumber))
@@ -14,7 +14,7 @@ contract('ERC721Mintable', function ([_, creator, ...accounts]) {
   const minter = creator;
 
   beforeEach(async function () {
-    this.token = await ERC721Mintable.new({
+    this.token = await ERC721MintableImpl.new({
       from: creator,
     });
   });

+ 2 - 2
test/token/ERC721/ERC721Pausable.test.js

@@ -3,7 +3,7 @@ const { shouldBehaveLikeERC721 } = require('./ERC721.behavior');
 const { shouldBehaveLikePublicRole } = require('../../access/roles/PublicRole.behavior');
 
 const BigNumber = web3.BigNumber;
-const ERC721Pausable = artifacts.require('ERC721PausableMock.sol');
+const ERC721PausableMock = artifacts.require('ERC721PausableMock.sol');
 
 require('chai')
   .use(require('chai-bignumber')(BigNumber))
@@ -18,7 +18,7 @@ contract('ERC721Pausable', function ([
   ...accounts
 ]) {
   beforeEach(async function () {
-    this.token = await ERC721Pausable.new({ from: creator });
+    this.token = await ERC721PausableMock.new({ from: creator });
   });
 
   describe('pauser role', function () {