diff options
author | Fabio Berger <me@fabioberger.com> | 2017-05-25 18:23:13 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2017-05-25 18:23:13 +0800 |
commit | 2117b4e0c87df277f5e8df54e8df922bdf19c298 (patch) | |
tree | 355fd7e1f9a34a88a6f190d0942f4348c553ecd6 /test/0x.js.ts | |
parent | ec2d3cc599e4b2b48669983f090b29581ba6f25d (diff) | |
download | dexon-sol-tools-2117b4e0c87df277f5e8df54e8df922bdf19c298.tar dexon-sol-tools-2117b4e0c87df277f5e8df54e8df922bdf19c298.tar.gz dexon-sol-tools-2117b4e0c87df277f5e8df54e8df922bdf19c298.tar.bz2 dexon-sol-tools-2117b4e0c87df277f5e8df54e8df922bdf19c298.tar.lz dexon-sol-tools-2117b4e0c87df277f5e8df54e8df922bdf19c298.tar.xz dexon-sol-tools-2117b4e0c87df277f5e8df54e8df922bdf19c298.tar.zst dexon-sol-tools-2117b4e0c87df277f5e8df54e8df922bdf19c298.zip |
Use expect.to.throw
Diffstat (limited to 'test/0x.js.ts')
-rw-r--r-- | test/0x.js.ts | 28 |
1 files changed, 4 insertions, 24 deletions
diff --git a/test/0x.js.ts b/test/0x.js.ts index 2c4471e0f..09266018b 100644 --- a/test/0x.js.ts +++ b/test/0x.js.ts @@ -21,12 +21,7 @@ describe('ZeroEx library', () => { r: signature.r, s: signature.s, }; - try { - const isValid = ZeroEx.isValidSignature(data, malformedSignature, address); - throw new Error('isValidSignature should have thrown'); - } catch (err) { - // continue - } + expect(() => ZeroEx.isValidSignature(data, malformedSignature, address)).to.throw(); }); it('r lacks 0x prefix', () => { const malformedR = signature.r.replace('0x', ''); @@ -35,12 +30,7 @@ describe('ZeroEx library', () => { r: malformedR, s: signature.s, }; - try { - const isValid = ZeroEx.isValidSignature(data, malformedSignature, address); - throw new Error('isValidSignature should have thrown'); - } catch (err) { - // continue - } + expect(() => ZeroEx.isValidSignature(data, malformedSignature, address)).to.throw(); }); it('r is too short', () => { const malformedR = signature.r.substr(10); @@ -49,12 +39,7 @@ describe('ZeroEx library', () => { r: malformedR, s: signature.s.replace('0', 'z'), }; - try { - const isValid = ZeroEx.isValidSignature(data, malformedSignature, address); - throw new Error('isValidSignature should have thrown'); - } catch (err) { - // continue - } + expect(() => ZeroEx.isValidSignature(data, malformedSignature, address)).to.throw(); }); it('s is not hex', () => { const malformedS = signature.s.replace('0', 'z'); @@ -63,12 +48,7 @@ describe('ZeroEx library', () => { r: signature.r, s: malformedS, }; - try { - const isValid = ZeroEx.isValidSignature(data, malformedSignature, address); - throw new Error('isValidSignature should have thrown'); - } catch (err) { - // continue - } + expect(() => ZeroEx.isValidSignature(data, malformedSignature, address)).to.throw(); }); }); it('should return false if the data doesn\'t pertain to the signature & address', () => { |