aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/test/token_registry.ts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-05-23 02:58:50 +0800
committerFabio Berger <me@fabioberger.com>2018-05-23 02:58:50 +0800
commit4cfeb6b8ace9c1613ac0581bd6ea52ff183701f9 (patch)
treea507d3fe9435829ebc802d5b3c0412fe655a52cd /packages/contracts/test/token_registry.ts
parent9373451ca8c19ac2ab20db792fd049ccf284f1f2 (diff)
parentcde85243d6eaf9376f499aa1cc28bd393130c2b9 (diff)
downloaddexon-sol-tools-4cfeb6b8ace9c1613ac0581bd6ea52ff183701f9.tar
dexon-sol-tools-4cfeb6b8ace9c1613ac0581bd6ea52ff183701f9.tar.gz
dexon-sol-tools-4cfeb6b8ace9c1613ac0581bd6ea52ff183701f9.tar.bz2
dexon-sol-tools-4cfeb6b8ace9c1613ac0581bd6ea52ff183701f9.tar.lz
dexon-sol-tools-4cfeb6b8ace9c1613ac0581bd6ea52ff183701f9.tar.xz
dexon-sol-tools-4cfeb6b8ace9c1613ac0581bd6ea52ff183701f9.tar.zst
dexon-sol-tools-4cfeb6b8ace9c1613ac0581bd6ea52ff183701f9.zip
Merge branch 'v2-prototype' of github.com:0xProject/0x-monorepo into v2-prototype
* 'v2-prototype' of github.com:0xProject/0x-monorepo: Rename some variables in multi_sig_with_time_lock.ts Remove extra awaitTransactionMinedAsync calls Apply changes to test/exchange/match_orders.ts Fix some unhandled promise rejections Add awaitTransactionMinedAsync after every sent transaction Add missing blockchainLifecycle calls to contracts tests
Diffstat (limited to 'packages/contracts/test/token_registry.ts')
-rw-r--r--packages/contracts/test/token_registry.ts29
1 files changed, 22 insertions, 7 deletions
diff --git a/packages/contracts/test/token_registry.ts b/packages/contracts/test/token_registry.ts
index 9e4f7ca3b..308dee8e6 100644
--- a/packages/contracts/test/token_registry.ts
+++ b/packages/contracts/test/token_registry.ts
@@ -25,6 +25,12 @@ describe('TokenRegistry', () => {
let tokenReg: TokenRegistryContract;
let tokenRegWrapper: TokenRegWrapper;
before(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ after(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+ before(async () => {
const accounts = await web3Wrapper.getAvailableAddressesAsync();
owner = accounts[0];
notOwner = accounts[1];
@@ -137,9 +143,12 @@ describe('TokenRegistry', () => {
});
it('should change the token name when called by owner', async () => {
- await tokenReg.setTokenName.sendTransactionAsync(token1.address, token2.name, {
- from: owner,
- });
+ await web3Wrapper.awaitTransactionMinedAsync(
+ await tokenReg.setTokenName.sendTransactionAsync(token1.address, token2.name, {
+ from: owner,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
const [newData, oldData] = await Promise.all([
tokenRegWrapper.getTokenByNameAsync(token2.name),
tokenRegWrapper.getTokenByNameAsync(token1.name),
@@ -176,7 +185,10 @@ describe('TokenRegistry', () => {
});
it('should change the token symbol when called by owner', async () => {
- await tokenReg.setTokenSymbol.sendTransactionAsync(token1.address, token2.symbol, { from: owner });
+ await web3Wrapper.awaitTransactionMinedAsync(
+ await tokenReg.setTokenSymbol.sendTransactionAsync(token1.address, token2.symbol, { from: owner }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
const [newData, oldData] = await Promise.all([
tokenRegWrapper.getTokenBySymbolAsync(token2.symbol),
tokenRegWrapper.getTokenBySymbolAsync(token1.symbol),
@@ -217,9 +229,12 @@ describe('TokenRegistry', () => {
it('should remove token metadata when called by owner', async () => {
const index = new BigNumber(0);
- await tokenReg.removeToken.sendTransactionAsync(token1.address, index, {
- from: owner,
- });
+ await web3Wrapper.awaitTransactionMinedAsync(
+ await tokenReg.removeToken.sendTransactionAsync(token1.address, index, {
+ from: owner,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
const tokenData = await tokenRegWrapper.getTokenMetaDataAsync(token1.address);
expect(tokenData).to.be.deep.equal(nullToken);
});