aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/test
diff options
context:
space:
mode:
authorAmir Bandeali <abandeali1@gmail.com>2018-05-22 22:39:21 +0800
committerAmir Bandeali <abandeali1@gmail.com>2018-05-25 06:39:19 +0800
commitd4aacd218a4fdb1876ac656e04fcccdb892a9395 (patch)
tree840ebd2fc7484340c0f426488d550e939ad0fb79 /packages/contracts/test
parent326a566db29031edf21320923e67dde309573efd (diff)
downloaddexon-sol-tools-d4aacd218a4fdb1876ac656e04fcccdb892a9395.tar
dexon-sol-tools-d4aacd218a4fdb1876ac656e04fcccdb892a9395.tar.gz
dexon-sol-tools-d4aacd218a4fdb1876ac656e04fcccdb892a9395.tar.bz2
dexon-sol-tools-d4aacd218a4fdb1876ac656e04fcccdb892a9395.tar.lz
dexon-sol-tools-d4aacd218a4fdb1876ac656e04fcccdb892a9395.tar.xz
dexon-sol-tools-d4aacd218a4fdb1876ac656e04fcccdb892a9395.tar.zst
dexon-sol-tools-d4aacd218a4fdb1876ac656e04fcccdb892a9395.zip
Move readFirst4 to LibBytes
Diffstat (limited to 'packages/contracts/test')
-rw-r--r--packages/contracts/test/asset_proxy_owner.ts22
-rw-r--r--packages/contracts/test/libraries/lib_bytes.ts8
2 files changed, 11 insertions, 19 deletions
diff --git a/packages/contracts/test/asset_proxy_owner.ts b/packages/contracts/test/asset_proxy_owner.ts
index 6e999dd99..e3c6a5324 100644
--- a/packages/contracts/test/asset_proxy_owner.ts
+++ b/packages/contracts/test/asset_proxy_owner.ts
@@ -56,9 +56,9 @@ describe('AssetProxyOwner', () => {
provider,
txDefaults,
owners,
+ defaultAssetProxyContractAddresses,
REQUIRED_APPROVALS,
SECONDS_TIME_LOCKED,
- defaultAssetProxyContractAddresses,
);
multiSigWrapper = new MultiSigWrapper(multiSig, zeroEx);
await erc20Proxy.transferOwnership.sendTransactionAsync(multiSig.address, { from: initialOwner });
@@ -79,9 +79,9 @@ describe('AssetProxyOwner', () => {
provider,
txDefaults,
owners,
+ assetProxyContractAddresses,
REQUIRED_APPROVALS,
SECONDS_TIME_LOCKED,
- assetProxyContractAddresses,
);
const isErc20ProxyRegistered = await newMultiSig.isAssetProxyRegistered.callAsync(erc20Proxy.address);
const isErc721ProxyRegistered = await newMultiSig.isAssetProxyRegistered.callAsync(erc721Proxy.address);
@@ -96,29 +96,13 @@ describe('AssetProxyOwner', () => {
provider,
txDefaults,
owners,
+ assetProxyContractAddresses,
REQUIRED_APPROVALS,
SECONDS_TIME_LOCKED,
- assetProxyContractAddresses,
),
).to.be.rejectedWith(constants.REVERT);
});
});
- describe('readFirst4', () => {
- it('should return the first 4 bytes of a byte array of arbitrary length', async () => {
- const addAuthorizedAddressData = erc20Proxy.addAuthorizedAddress.getABIEncodedTransactionData(owners[0]);
- const removeAuthorizedAddressData = erc20Proxy.removeAuthorizedAddress.getABIEncodedTransactionData(
- owners[0],
- );
- const expectedAddAuthorizedAddressSelector = addAuthorizedAddressData.slice(0, 10);
- const expectedRemoveAuthorizedAddressSelector = removeAuthorizedAddressData.slice(0, 10);
- const [addAuthorizedAddressSelector, removeAuthorizedAddressSelector] = await Promise.all([
- multiSig.readFirst4.callAsync(addAuthorizedAddressData),
- multiSig.readFirst4.callAsync(removeAuthorizedAddressData),
- ]);
- expect(expectedAddAuthorizedAddressSelector).to.equal(addAuthorizedAddressSelector);
- expect(expectedRemoveAuthorizedAddressSelector).to.equal(removeAuthorizedAddressSelector);
- });
- });
describe('isFunctionRemoveAuthorizedAddress', () => {
it('should throw if data is not for removeAuthorizedAddress', async () => {
diff --git a/packages/contracts/test/libraries/lib_bytes.ts b/packages/contracts/test/libraries/lib_bytes.ts
index ce3adbdae..fc28c363b 100644
--- a/packages/contracts/test/libraries/lib_bytes.ts
+++ b/packages/contracts/test/libraries/lib_bytes.ts
@@ -248,4 +248,12 @@ describe('LibBytes', () => {
it('should fail if the length between the offset and end of the byte array is too short to hold a uint256)', async () => {});
});
*/
+
+ describe('readFirst4', () => {
+ it('should return the first 4 bytes of a byte array of arbitrary length', async () => {
+ const first4Bytes = libBytes.publicReadFirst4.callAsync(byteArrayLongerThan32Bytes);
+ const expectedFirst4Bytes = byteArrayLongerThan32Bytes.slice(0, 10);
+ expect(first4Bytes).to.equal(expectedFirst4Bytes);
+ });
+ });
});