aboutsummaryrefslogtreecommitdiffstats
path: root/packages/web3-wrapper/test/web3_wrapper_test.ts
diff options
context:
space:
mode:
authorJacob Evans <dekz@dekz.net>2018-10-09 18:17:11 +0800
committerGitHub <noreply@github.com>2018-10-09 18:17:11 +0800
commit024bcf492ddbdceb033466aeadef220adc145332 (patch)
tree01a364d769f3eede04f4bd1e4a743784d39eea91 /packages/web3-wrapper/test/web3_wrapper_test.ts
parent3ac9dac4f0a6b3875b7ae0ea6dd1855743768ef2 (diff)
parent75b9e639194e98febf8e378619afef2d578cbc7e (diff)
downloaddexon-0x-contracts-024bcf492ddbdceb033466aeadef220adc145332.tar.gz
dexon-0x-contracts-024bcf492ddbdceb033466aeadef220adc145332.tar.zst
dexon-0x-contracts-024bcf492ddbdceb033466aeadef220adc145332.zip
Merge pull request #1102 from 0xProject/feature/0x.js/eip712-sign-typed-data
[0x.js][order-utils][web3-wrapper] Expose eth_signTypedData functionality for order signing
Diffstat (limited to 'packages/web3-wrapper/test/web3_wrapper_test.ts')
-rw-r--r--packages/web3-wrapper/test/web3_wrapper_test.ts15
1 files changed, 14 insertions, 1 deletions
diff --git a/packages/web3-wrapper/test/web3_wrapper_test.ts b/packages/web3-wrapper/test/web3_wrapper_test.ts
index 385c469bf..164253777 100644
--- a/packages/web3-wrapper/test/web3_wrapper_test.ts
+++ b/packages/web3-wrapper/test/web3_wrapper_test.ts
@@ -1,5 +1,5 @@
import * as chai from 'chai';
-import { BlockParamLiteral } from 'ethereum-types';
+import { BlockParamLiteral, JSONRPCErrorCallback, JSONRPCRequestPayload } from 'ethereum-types';
import * as Ganache from 'ganache-core';
import * as _ from 'lodash';
import 'mocha';
@@ -78,6 +78,19 @@ describe('Web3Wrapper tests', () => {
const signatureLength = 132;
expect(signature.length).to.be.equal(signatureLength);
});
+ it('should throw if the provider returns an error', async () => {
+ const message = '0xdeadbeef';
+ const signer = addresses[1];
+ const fakeProvider = {
+ async sendAsync(payload: JSONRPCRequestPayload, callback: JSONRPCErrorCallback): Promise<void> {
+ callback(new Error('User denied message signature'));
+ },
+ };
+ const errorWeb3Wrapper = new Web3Wrapper(fakeProvider);
+ expect(errorWeb3Wrapper.signMessageAsync(signer, message)).to.be.rejectedWith(
+ 'User denied message signature',
+ );
+ });
});
describe('#getBlockNumberAsync', () => {
it('get block number', async () => {