aboutsummaryrefslogtreecommitdiffstats
path: root/packages/order-utils/test
diff options
context:
space:
mode:
authorSteve Klebanoff <steve.klebanoff@gmail.com>2018-10-27 03:47:24 +0800
committerSteve Klebanoff <steve.klebanoff@gmail.com>2018-10-27 03:47:24 +0800
commit9be4c4749935a765cbd55783735d1d1f719322c0 (patch)
tree49c3f3f42e58b49547799e6dfadc1b10c82381db /packages/order-utils/test
parent9512978de9aee1953930d4f16a105ec5ef7f048e (diff)
parentaf91a56a5594d07d7da6caaeff79f5a7fb31ff98 (diff)
downloaddexon-sol-tools-9be4c4749935a765cbd55783735d1d1f719322c0.tar
dexon-sol-tools-9be4c4749935a765cbd55783735d1d1f719322c0.tar.gz
dexon-sol-tools-9be4c4749935a765cbd55783735d1d1f719322c0.tar.bz2
dexon-sol-tools-9be4c4749935a765cbd55783735d1d1f719322c0.tar.lz
dexon-sol-tools-9be4c4749935a765cbd55783735d1d1f719322c0.tar.xz
dexon-sol-tools-9be4c4749935a765cbd55783735d1d1f719322c0.tar.zst
dexon-sol-tools-9be4c4749935a765cbd55783735d1d1f719322c0.zip
Merge branch 'development' into feature/not-enough-eth
Diffstat (limited to 'packages/order-utils/test')
-rw-r--r--packages/order-utils/test/asset_data_utils_test.ts25
1 files changed, 22 insertions, 3 deletions
diff --git a/packages/order-utils/test/asset_data_utils_test.ts b/packages/order-utils/test/asset_data_utils_test.ts
index f8b850604..f175b7a38 100644
--- a/packages/order-utils/test/asset_data_utils_test.ts
+++ b/packages/order-utils/test/asset_data_utils_test.ts
@@ -1,6 +1,7 @@
import * as chai from 'chai';
-import { ERC20AssetData } from '@0x/types';
+import { ERC20AssetData, ERC721AssetData } from '@0x/types';
+import { BigNumber } from '@0x/utils';
import { assetDataUtils } from '../src/asset_data_utils';
@@ -14,18 +15,36 @@ const KNOWN_ENCODINGS = [
address: '0x1dc4c1cefef38a777b15aa20260a54e584b16c48',
assetData: '0xf47261b00000000000000000000000001dc4c1cefef38a777b15aa20260a54e584b16c48',
},
+ {
+ address: '0x1dc4c1cefef38a777b15aa20260a54e584b16c48',
+ tokenId: new BigNumber(1),
+ assetData:
+ '0x025717920000000000000000000000001dc4c1cefef38a777b15aa20260a54e584b16c480000000000000000000000000000000000000000000000000000000000000001',
+ },
];
const ERC20_ASSET_PROXY_ID = '0xf47261b0';
+const ERC721_ASSET_PROXY_ID = '0x02571792';
describe('assetDataUtils', () => {
- it('should encode', () => {
+ it('should encode ERC20', () => {
const assetData = assetDataUtils.encodeERC20AssetData(KNOWN_ENCODINGS[0].address);
expect(assetData).to.equal(KNOWN_ENCODINGS[0].assetData);
});
- it('should decode', () => {
+ it('should decode ERC20', () => {
const assetData: ERC20AssetData = assetDataUtils.decodeERC20AssetData(KNOWN_ENCODINGS[0].assetData);
expect(assetData.tokenAddress).to.equal(KNOWN_ENCODINGS[0].address);
expect(assetData.assetProxyId).to.equal(ERC20_ASSET_PROXY_ID);
});
+ it('should encode ERC721', () => {
+ const assetData = assetDataUtils.encodeERC721AssetData(KNOWN_ENCODINGS[1].address, KNOWN_ENCODINGS[1]
+ .tokenId as BigNumber);
+ expect(assetData).to.equal(KNOWN_ENCODINGS[1].assetData);
+ });
+ it('should decode ERC721', () => {
+ const assetData: ERC721AssetData = assetDataUtils.decodeERC721AssetData(KNOWN_ENCODINGS[1].assetData);
+ expect(assetData.tokenAddress).to.equal(KNOWN_ENCODINGS[1].address);
+ expect(assetData.assetProxyId).to.equal(ERC721_ASSET_PROXY_ID);
+ expect(assetData.tokenId).to.be.bignumber.equal(KNOWN_ENCODINGS[1].tokenId);
+ });
});