diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-12-19 23:22:57 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-12-19 23:22:57 +0800 |
commit | 75f637bd756fd7d4480792ead7bd86dd8326e622 (patch) | |
tree | 000fd6a09f2fcaedd640a8580ba8f8c90185958e /packages/0x.js/test | |
parent | 1316a2dd2a8971771f750d8a7f457212daad520b (diff) | |
download | dexon-sol-tools-75f637bd756fd7d4480792ead7bd86dd8326e622.tar dexon-sol-tools-75f637bd756fd7d4480792ead7bd86dd8326e622.tar.gz dexon-sol-tools-75f637bd756fd7d4480792ead7bd86dd8326e622.tar.bz2 dexon-sol-tools-75f637bd756fd7d4480792ead7bd86dd8326e622.tar.lz dexon-sol-tools-75f637bd756fd7d4480792ead7bd86dd8326e622.tar.xz dexon-sol-tools-75f637bd756fd7d4480792ead7bd86dd8326e622.tar.zst dexon-sol-tools-75f637bd756fd7d4480792ead7bd86dd8326e622.zip |
Throw a better error message when taker is null|undefined or anything but not a string
Diffstat (limited to 'packages/0x.js/test')
-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[] = []; |