diff options
author | Fabio Berger <me@fabioberger.com> | 2017-12-21 16:33:57 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2017-12-21 16:33:57 +0800 |
commit | 85e16c1233fc2c7020c2556cd79ac7d53cee4c98 (patch) | |
tree | 8a2463e38f9c9e84179dd06da52893b740a613a9 /packages/0x.js/test | |
parent | 42b3a7c9d756dd2c68256707c0c96a95370329bd (diff) | |
download | dexon-0x-contracts-85e16c1233fc2c7020c2556cd79ac7d53cee4c98.tar.gz dexon-0x-contracts-85e16c1233fc2c7020c2556cd79ac7d53cee4c98.tar.zst dexon-0x-contracts-85e16c1233fc2c7020c2556cd79ac7d53cee4c98.zip |
Make assertion stricter so that one cannot submit invalid baseUnit amounts to `toUnitAmount`
Diffstat (limited to 'packages/0x.js/test')
-rw-r--r-- | packages/0x.js/test/0x.js_test.ts | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/packages/0x.js/test/0x.js_test.ts b/packages/0x.js/test/0x.js_test.ts index 8d62b3518..9bf504909 100644 --- a/packages/0x.js/test/0x.js_test.ts +++ b/packages/0x.js/test/0x.js_test.ts @@ -114,6 +114,12 @@ describe('ZeroEx library', () => { }); }); describe('#toUnitAmount', () => { + it('should throw if invalid baseUnit amount supplied as argument', () => { + const invalidBaseUnitAmount = new BigNumber(1000000000.4); + const decimals = 6; + expect(() => ZeroEx.toUnitAmount(invalidBaseUnitAmount, decimals)) + .to.throw('amount should be in baseUnits (no decimals), found value: 1000000000.4'); + }); it('Should return the expected unit amount for the decimals passed in', () => { const baseUnitAmount = new BigNumber(1000000000); const decimals = 6; |