aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Hysen <greg.hysen@gmail.com>2018-04-13 08:55:06 +0800
committerAmir Bandeali <abandeali1@gmail.com>2018-04-21 04:56:17 +0800
commit4e48de111600412c6344bc5c4df42e4d17807e97 (patch)
treeaa6dde3f7a4c287c158f0965300a861bae20cf26
parentb3b29f527e3e3e435b5fe97dd7eb4a42f0fa182c (diff)
downloaddexon-sol-tools-4e48de111600412c6344bc5c4df42e4d17807e97.tar.gz
dexon-sol-tools-4e48de111600412c6344bc5c4df42e4d17807e97.tar.zst
dexon-sol-tools-4e48de111600412c6344bc5c4df42e4d17807e97.zip
Minor changes to typescript tests
-rw-r--r--packages/contracts/src/utils/asset_proxy_utils.ts4
-rw-r--r--packages/contracts/src/utils/crypto.ts2
-rw-r--r--packages/contracts/test/asset_proxy_dispatcher/dispatcher.ts8
3 files changed, 6 insertions, 8 deletions
diff --git a/packages/contracts/src/utils/asset_proxy_utils.ts b/packages/contracts/src/utils/asset_proxy_utils.ts
index 63de7252d..529d31cb9 100644
--- a/packages/contracts/src/utils/asset_proxy_utils.ts
+++ b/packages/contracts/src/utils/asset_proxy_utils.ts
@@ -5,9 +5,7 @@ import ethUtil = require('ethereumjs-util');
import { AssetProxyId } from './types';
export function encodeAssetProxyId(assetProxyId: AssetProxyId): Buffer {
- const formattedAssetProxyId = new BN(assetProxyId);
- const encodedAssetProxyId = ethUtil.toUnsigned(formattedAssetProxyId);
- return encodedAssetProxyId;
+ return ethUtil.toBuffer(assetProxyId);
}
export function encodeAddress(address: string): Buffer {
diff --git a/packages/contracts/src/utils/crypto.ts b/packages/contracts/src/utils/crypto.ts
index 5bc678cdf..222cb7cca 100644
--- a/packages/contracts/src/utils/crypto.ts
+++ b/packages/contracts/src/utils/crypto.ts
@@ -31,7 +31,7 @@ export const crypto = {
argTypes.push('address');
} else if (_.isString(arg)) {
argTypes.push('string');
- } else if (arg instanceof Buffer) {
+ } else if (_.isBuffer(arg)) {
argTypes.push('bytes');
} else if (_.isBoolean(arg)) {
argTypes.push('bool');
diff --git a/packages/contracts/test/asset_proxy_dispatcher/dispatcher.ts b/packages/contracts/test/asset_proxy_dispatcher/dispatcher.ts
index f466670a8..8f430ee94 100644
--- a/packages/contracts/test/asset_proxy_dispatcher/dispatcher.ts
+++ b/packages/contracts/test/asset_proxy_dispatcher/dispatcher.ts
@@ -183,7 +183,7 @@ describe('AssetProxyDispatcher', () => {
expect(proxyAddress).to.be.equal(newAddress);
});
- it('should throw if registering with incorrect "old_address" field', async () => {
+ it('should throw if registering with incorrect "currentAssetProxyAddress" field', async () => {
// Initial registration
await assetProxyDispatcher.addAssetProxy.sendTransactionAsync(
AssetProxyId.ERC20,
@@ -225,7 +225,7 @@ describe('AssetProxyDispatcher', () => {
expect(newProxyAddress).to.be.equal(ZeroEx.NULL_ADDRESS);
});
- it('should throw if requesting address is not authorized', async () => {
+ it('should throw if requesting address is not owner', async () => {
return expect(
assetProxyDispatcher.addAssetProxy.sendTransactionAsync(
AssetProxyId.ERC20,
@@ -286,7 +286,7 @@ describe('AssetProxyDispatcher', () => {
);
});
- it('should throw if delegating to unregistered proxy', async () => {
+ it('should throw if dispatching to unregistered proxy', async () => {
// Construct metadata for ERC20 proxy
const encodedProxyMetadata = encodeERC20ProxyData(zrx.address);
// Perform a transfer from makerAddress to takerAddress
@@ -298,7 +298,7 @@ describe('AssetProxyDispatcher', () => {
makerAddress,
takerAddress,
amount,
- { from: notOwner },
+ { from: exchangeAddress },
),
).to.be.rejectedWith(constants.REVERT);
});