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 0056ed4b5..5de751780 100644
--- a/packages/contracts/test/zrx_token.ts
+++ b/packages/contracts/test/zrx_token.ts
@@ -6,12 +6,10 @@ import * as chai from 'chai';
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;
@@ -24,7 +22,7 @@ describe('ZRXToken', () => {
let MAX_UINT: BigNumber;
- let zrx: ZRXTokenContract;
+ let zrxToken: ZRXTokenContract;
let zrxAddress: string;
before(async () => {
@@ -34,8 +32,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 () => {
@@ -46,25 +44,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);
});
@@ -73,7 +71,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);
});
});
@@ -94,7 +92,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();
@@ -108,7 +106,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();
});
@@ -120,13 +120,17 @@ describe('ZRXToken', () => {
const spenderAllowanceIsInsufficient = spenderAllowance.cmp(amountToTransfer) < 0;
expect(spenderAllowanceIsInsufficient).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();
});