diff options
author | Fabio Berger <me@fabioberger.com> | 2017-05-25 18:11:12 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2017-05-25 18:11:12 +0800 |
commit | ec2d3cc599e4b2b48669983f090b29581ba6f25d (patch) | |
tree | 1dd0dc0e8dc972bf969a3a1e9447fbc3af9ca63d /test | |
parent | 56dfe6b2ff4a5ee7f5dd6c721f2e1cc9d6358998 (diff) | |
parent | 334d2f175fd9dcb3f9e336250d21c7916a2671ae (diff) | |
download | dexon-0x-contracts-ec2d3cc599e4b2b48669983f090b29581ba6f25d.tar.gz dexon-0x-contracts-ec2d3cc599e4b2b48669983f090b29581ba6f25d.tar.zst dexon-0x-contracts-ec2d3cc599e4b2b48669983f090b29581ba6f25d.zip |
Merge branch 'master' into addSchemas
# Conflicts:
# package.json
Diffstat (limited to 'test')
-rw-r--r-- | test/0x.js.ts | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/0x.js.ts b/test/0x.js.ts index 4d0b03a2a..2c4471e0f 100644 --- a/test/0x.js.ts +++ b/test/0x.js.ts @@ -1,6 +1,7 @@ import {ZeroEx} from '../src/ts/0x.js'; import {expect} from 'chai'; import 'mocha'; +import * as BigNumber from 'bignumber.js'; describe('ZeroEx library', () => { describe('#isValidSignature', () => { @@ -89,4 +90,16 @@ describe('ZeroEx library', () => { expect(isValid).to.be.true; }); }); + describe('#generateSalt', () => { + it('generates different salts', () => { + const equal = ZeroEx.generatePseudoRandomSalt().eq(ZeroEx.generatePseudoRandomSalt()); + expect(equal).to.be.false; + }); + it('generates salt in range [0..2^256)', () => { + const salt = ZeroEx.generatePseudoRandomSalt(); + expect(salt.greaterThanOrEqualTo(0)).to.be.true; + const twoPow256 = new BigNumber(2).pow(256); + expect(salt.lessThan(twoPow256)).to.be.true; + }); + }); }); |