aboutsummaryrefslogtreecommitdiffstats
path: root/packages/assert/test/assert_test.ts
diff options
context:
space:
mode:
authorJacob Evans <dekz@dekz.net>2018-01-19 09:19:14 +0800
committerGitHub <noreply@github.com>2018-01-19 09:19:14 +0800
commit22b1ee132a904757e4bfb7ed33826cb849029d2a (patch)
tree7fa2dcd7a8a14cc640a2a7b75d28dfcdf9b9b1f0 /packages/assert/test/assert_test.ts
parent4ac6e5477dfe648722faa7cdd7b7752ad929d08d (diff)
parentab7f681f153778a5af4e2e2ac7713c384fe3ec79 (diff)
downloaddexon-0x-contracts-22b1ee132a904757e4bfb7ed33826cb849029d2a.tar
dexon-0x-contracts-22b1ee132a904757e4bfb7ed33826cb849029d2a.tar.gz
dexon-0x-contracts-22b1ee132a904757e4bfb7ed33826cb849029d2a.tar.bz2
dexon-0x-contracts-22b1ee132a904757e4bfb7ed33826cb849029d2a.tar.lz
dexon-0x-contracts-22b1ee132a904757e4bfb7ed33826cb849029d2a.tar.xz
dexon-0x-contracts-22b1ee132a904757e4bfb7ed33826cb849029d2a.tar.zst
dexon-0x-contracts-22b1ee132a904757e4bfb7ed33826cb849029d2a.zip
Merge pull request #324 from 0xProject/fix/0x.js/negativeFillValues
Reject negative amounts in public methods
Diffstat (limited to 'packages/assert/test/assert_test.ts')
-rw-r--r--packages/assert/test/assert_test.ts14
1 files changed, 14 insertions, 0 deletions
diff --git a/packages/assert/test/assert_test.ts b/packages/assert/test/assert_test.ts
index ff337196d..b0fa398d6 100644
--- a/packages/assert/test/assert_test.ts
+++ b/packages/assert/test/assert_test.ts
@@ -22,6 +22,20 @@ describe('Assertions', () => {
invalidInputs.forEach(input => expect(assert.isBigNumber.bind(assert, variableName, input)).to.throw());
});
});
+ describe('#isValidBaseUnitAmount', () => {
+ it('should not throw for valid input', () => {
+ const validInputs = [new BigNumber(23), new BigNumber('45000000')];
+ validInputs.forEach(input =>
+ expect(assert.isValidBaseUnitAmount.bind(assert, variableName, input)).to.not.throw(),
+ );
+ });
+ it('should throw for invalid input', () => {
+ const invalidInputs = [0, undefined, new BigNumber(3.145), 3.145, new BigNumber(-400)];
+ invalidInputs.forEach(input =>
+ expect(assert.isValidBaseUnitAmount.bind(assert, variableName, input)).to.throw(),
+ );
+ });
+ });
describe('#isString', () => {
it('should not throw for valid input', () => {
const validInputs = ['hello', 'goodbye'];