aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/test/zrx_token.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/contracts/test/zrx_token.ts')
-rw-r--r--packages/contracts/test/zrx_token.ts40
1 files changed, 22 insertions, 18 deletions
diff --git a/packages/contracts/test/zrx_token.ts b/packages/contracts/test/zrx_token.ts
index 63c40f0e7..48b8f6e36 100644
--- a/packages/contracts/test/zrx_token.ts
+++ b/packages/contracts/test/zrx_token.ts
@@ -7,12 +7,10 @@ import 'make-promises-safe';
import * as Web3 from 'web3';
import { ZRXTokenContract } from '../src/contract_wrappers/generated/zrx_token';
-import { artifacts } from '../util/artifacts';
-import { constants } from '../util/constants';
-import { ContractName } from '../util/types';
-
-import { chaiSetup } from './utils/chai_setup';
-import { provider, txDefaults, web3Wrapper } from './utils/web3_wrapper';
+import { artifacts } from '../src/utils/artifacts';
+import { chaiSetup } from '../src/utils/chai_setup';
+import { constants } from '../src/utils/constants';
+import { provider, txDefaults, web3Wrapper } from '../src/utils/web3_wrapper';
chaiSetup.configure();
const expect = chai.expect;
@@ -25,7 +23,7 @@ describe('ZRXToken', () => {
let MAX_UINT: BigNumber;
- let zrx: ZRXTokenContract;
+ let zrxToken: ZRXTokenContract;
let zrxAddress: string;
before(async () => {
@@ -35,8 +33,8 @@ describe('ZRXToken', () => {
zeroEx = new ZeroEx(provider, {
networkId: constants.TESTRPC_NETWORK_ID,
});
- zrx = await ZRXTokenContract.deployFrom0xArtifactAsync(artifacts.ZRX, provider, txDefaults);
- zrxAddress = zrx.address;
+ zrxToken = await ZRXTokenContract.deployFrom0xArtifactAsync(artifacts.ZRX, provider, txDefaults);
+ zrxAddress = zrxToken.address;
MAX_UINT = zeroEx.token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS;
});
beforeEach(async () => {
@@ -47,25 +45,25 @@ describe('ZRXToken', () => {
});
describe('constants', () => {
it('should have 18 decimals', async () => {
- const decimals = new BigNumber(await zrx.decimals.callAsync());
+ const decimals = new BigNumber(await zrxToken.decimals.callAsync());
const expectedDecimals = 18;
expect(decimals).to.be.bignumber.equal(expectedDecimals);
});
it('should have a total supply of 1 billion tokens', async () => {
- const totalSupply = new BigNumber(await zrx.totalSupply.callAsync());
+ const totalSupply = new BigNumber(await zrxToken.totalSupply.callAsync());
const expectedTotalSupply = 1000000000;
expect(ZeroEx.toUnitAmount(totalSupply, 18)).to.be.bignumber.equal(expectedTotalSupply);
});
it('should be named 0x Protocol Token', async () => {
- const name = await zrx.name.callAsync();
+ const name = await zrxToken.name.callAsync();
const expectedName = '0x Protocol Token';
expect(name).to.be.equal(expectedName);
});
it('should have the symbol ZRX', async () => {
- const symbol = await zrx.symbol.callAsync();
+ const symbol = await zrxToken.symbol.callAsync();
const expectedSymbol = 'ZRX';
expect(symbol).to.be.equal(expectedSymbol);
});
@@ -74,7 +72,7 @@ describe('ZRXToken', () => {
describe('constructor', () => {
it('should initialize owner balance to totalSupply', async () => {
const ownerBalance = await zeroEx.token.getBalanceAsync(zrxAddress, owner);
- const totalSupply = new BigNumber(await zrx.totalSupply.callAsync());
+ const totalSupply = new BigNumber(await zrxToken.totalSupply.callAsync());
expect(totalSupply).to.be.bignumber.equal(ownerBalance);
});
});
@@ -95,7 +93,7 @@ describe('ZRXToken', () => {
});
it('should return true on a 0 value transfer', async () => {
- const didReturnTrue = await zrx.transfer.callAsync(spender, new BigNumber(0), {
+ const didReturnTrue = await zrxToken.transfer.callAsync(spender, new BigNumber(0), {
from: owner,
});
expect(didReturnTrue).to.be.true();
@@ -109,7 +107,9 @@ describe('ZRXToken', () => {
await zeroEx.token.setAllowanceAsync(zrxAddress, owner, spender, amountToTransfer, {
gasLimit: constants.MAX_TOKEN_APPROVE_GAS,
});
- const didReturnTrue = await zrx.transferFrom.callAsync(owner, spender, amountToTransfer, { from: spender });
+ const didReturnTrue = await zrxToken.transferFrom.callAsync(owner, spender, amountToTransfer, {
+ from: spender,
+ });
expect(didReturnTrue).to.be.false();
});
@@ -121,13 +121,17 @@ describe('ZRXToken', () => {
const isSpenderAllowanceInsufficient = spenderAllowance.cmp(amountToTransfer) < 0;
expect(isSpenderAllowanceInsufficient).to.be.true();
- const didReturnTrue = await zrx.transferFrom.callAsync(owner, spender, amountToTransfer, { from: spender });
+ const didReturnTrue = await zrxToken.transferFrom.callAsync(owner, spender, amountToTransfer, {
+ from: spender,
+ });
expect(didReturnTrue).to.be.false();
});
it('should return true on a 0 value transfer', async () => {
const amountToTransfer = new BigNumber(0);
- const didReturnTrue = await zrx.transferFrom.callAsync(owner, spender, amountToTransfer, { from: spender });
+ const didReturnTrue = await zrxToken.transferFrom.callAsync(owner, spender, amountToTransfer, {
+ from: spender,
+ });
expect(didReturnTrue).to.be.true();
});