diff options
author | Leonid <logvinov.leon@gmail.com> | 2017-12-20 20:06:21 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-20 20:06:21 +0800 |
commit | b603197ae837dca86d712760f9b18f626628096a (patch) | |
tree | ae422c9a387c656320f9b812f64b5660d536d0a0 /packages/0x.js/test/0x.js_test.ts | |
parent | 14c994ce1472e2fbd56efb73387505edd2a3ebc1 (diff) | |
parent | 3c66f18a46ae297181bdc82023a8e8bd895eebe1 (diff) | |
download | dexon-0x-contracts-b603197ae837dca86d712760f9b18f626628096a.tar.gz dexon-0x-contracts-b603197ae837dca86d712760f9b18f626628096a.tar.zst dexon-0x-contracts-b603197ae837dca86d712760f9b18f626628096a.zip |
Merge pull request #278 from 0xProject/fix/error-taker-format
Throw a better error message when taker is null|undefined or anything but not a string
Diffstat (limited to 'packages/0x.js/test/0x.js_test.ts')
-rw-r--r-- | packages/0x.js/test/0x.js_test.ts | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/packages/0x.js/test/0x.js_test.ts b/packages/0x.js/test/0x.js_test.ts index 819ac12f9..8d62b3518 100644 --- a/packages/0x.js/test/0x.js_test.ts +++ b/packages/0x.js/test/0x.js_test.ts @@ -152,6 +152,15 @@ describe('ZeroEx library', () => { const orderHash = ZeroEx.getOrderHashHex(order); expect(orderHash).to.be.equal(expectedOrderHash); }); + it('throws a readable error message if taker format is invalid', async () => { + const orderWithInvalidtakerFormat = { + ...order, + taker: null as any as string, + }; + // tslint:disable-next-line:max-line-length + const expectedErrorMessage = 'Order taker must be of type string. If you want anyone to be able to fill an order - pass ZeroEx.NULL_ADDRESS'; + expect(() => ZeroEx.getOrderHashHex(orderWithInvalidtakerFormat)).to.throw(expectedErrorMessage); + }); }); describe('#signOrderHashAsync', () => { let stubs: Sinon.SinonStub[] = []; |