aboutsummaryrefslogtreecommitdiffstats
path: root/test/0x.js.ts
diff options
context:
space:
mode:
Diffstat (limited to 'test/0x.js.ts')
-rw-r--r--test/0x.js.ts16
1 files changed, 15 insertions, 1 deletions
diff --git a/test/0x.js.ts b/test/0x.js.ts
index 46e5c4da5..a913fd6b5 100644
--- a/test/0x.js.ts
+++ b/test/0x.js.ts
@@ -57,7 +57,7 @@ describe('ZeroEx library', () => {
});
});
it('should return false if the data doesn\'t pertain to the signature & address', () => {
- const isValid = ZeroEx.isValidSignature('wrong data', signature, address);
+ const isValid = ZeroEx.isValidSignature('0x0', signature, address);
expect(isValid).to.be.false;
});
it('should return false if the address doesn\'t pertain to the signature & data', () => {
@@ -87,6 +87,20 @@ describe('ZeroEx library', () => {
expect(salt.lessThan(twoPow256)).to.be.true;
});
});
+ describe('#isValidOrderHash', () => {
+ it('returns false if the value is not a hex string', () => {
+ const isValid = ZeroEx.isValidOrderHash('not a hex');
+ expect(isValid).to.be.false;
+ });
+ it('returns false if the length is wrong', () => {
+ const isValid = ZeroEx.isValidOrderHash('0xdeadbeef');
+ expect(isValid).to.be.false;
+ });
+ it('returns true if order hash is correct', () => {
+ const isValid = ZeroEx.isValidOrderHash('0x' + Array(65).join('0'));
+ expect(isValid).to.be.true;
+ });
+ });
describe('#toUnitAmount', () => {
it('Should return the expected unit amount for the decimals passed in', () => {
const baseUnitAmount = new BigNumber(1000000000);