aboutsummaryrefslogtreecommitdiffstats
path: root/packages/subproviders/test/unit/private_key_wallet_subprovider_test.ts
diff options
context:
space:
mode:
authorJacob Evans <jacob@dekz.net>2018-04-11 16:48:46 +0800
committerJacob Evans <jacob@dekz.net>2018-04-11 17:08:28 +0800
commit916b4d3a26e6189c77634b0d2cde4d20bb4cb9a9 (patch)
tree663308bd8318c36867d4b216ea3ebcb15c6aa7cf /packages/subproviders/test/unit/private_key_wallet_subprovider_test.ts
parentf44ef7ce59cd5c811a92662d3fb095f21d80f665 (diff)
downloaddexon-sol-tools-916b4d3a26e6189c77634b0d2cde4d20bb4cb9a9.tar
dexon-sol-tools-916b4d3a26e6189c77634b0d2cde4d20bb4cb9a9.tar.gz
dexon-sol-tools-916b4d3a26e6189c77634b0d2cde4d20bb4cb9a9.tar.bz2
dexon-sol-tools-916b4d3a26e6189c77634b0d2cde4d20bb4cb9a9.tar.lz
dexon-sol-tools-916b4d3a26e6189c77634b0d2cde4d20bb4cb9a9.tar.xz
dexon-sol-tools-916b4d3a26e6189c77634b0d2cde4d20bb4cb9a9.tar.zst
dexon-sol-tools-916b4d3a26e6189c77634b0d2cde4d20bb4cb9a9.zip
Renamed DerivedHDKey to DerivedHDKeyInfo
Added assertions on addresses for public methods Throw a helpful error message when signer address is not instantiated address in PrivateKeyWalletSubprovider Update changelog and rename derivationBasePath to baseDerivationPath When returning undefined use pattern of IfExists Added configuration object for MnemonicWallet Put constants back into each individual wallet rather than in walletUtils Delete accidental package-lock.json
Diffstat (limited to 'packages/subproviders/test/unit/private_key_wallet_subprovider_test.ts')
-rw-r--r--packages/subproviders/test/unit/private_key_wallet_subprovider_test.ts16
1 files changed, 9 insertions, 7 deletions
diff --git a/packages/subproviders/test/unit/private_key_wallet_subprovider_test.ts b/packages/subproviders/test/unit/private_key_wallet_subprovider_test.ts
index b84aebb18..5c1b5cd25 100644
--- a/packages/subproviders/test/unit/private_key_wallet_subprovider_test.ts
+++ b/packages/subproviders/test/unit/private_key_wallet_subprovider_test.ts
@@ -128,18 +128,20 @@ describe('PrivateKeyWalletSubprovider', () => {
});
provider.sendAsync(payload, callback);
});
- it('should throw if `address` param is not an address from private key when calling personal_sign', (done: DoneCallback) => {
- const nonHexMessage = 'hello world';
+ it('should throw if `address` param is not the address from private key when calling personal_sign', (done: DoneCallback) => {
+ const messageHex = ethUtils.bufferToHex(ethUtils.toBuffer(fixtureData.PERSONAL_MESSAGE_STRING));
const payload = {
jsonrpc: '2.0',
method: 'personal_sign',
- params: [nonHexMessage, fixtureData.TEST_RPC_ACCOUNT_1],
+ params: [messageHex, fixtureData.TEST_RPC_ACCOUNT_1],
id: 1,
};
const callback = reportCallbackErrors(done)((err: Error, response: JSONRPCResponsePayload) => {
expect(err).to.not.be.a('null');
expect(err.message).to.be.equal(
- `${WalletSubproviderErrors.FromAddressMissingOrInvalid}: ${fixtureData.TEST_RPC_ACCOUNT_1}`,
+ `Requested to sign message with address: ${
+ fixtureData.TEST_RPC_ACCOUNT_1
+ }, instantiated with address: ${fixtureData.TEST_RPC_ACCOUNT_0}`,
);
done();
});
@@ -183,16 +185,16 @@ describe('PrivateKeyWalletSubprovider', () => {
provider.sendAsync(payload, callback);
});
it('should throw if `address` param not found when calling personal_sign', (done: DoneCallback) => {
- const nonHexMessage = 'hello world';
+ const messageHex = ethUtils.bufferToHex(ethUtils.toBuffer(fixtureData.PERSONAL_MESSAGE_STRING));
const payload = {
jsonrpc: '2.0',
method: 'personal_sign',
- params: [nonHexMessage, '0x0'],
+ params: [messageHex, '0x0'],
id: 1,
};
const callback = reportCallbackErrors(done)((err: Error, response: JSONRPCResponsePayload) => {
expect(err).to.not.be.a('null');
- expect(err.message).to.be.equal(`${WalletSubproviderErrors.FromAddressMissingOrInvalid}: 0x0`);
+ expect(err.message).to.be.equal(`Expected address to be of type ETHAddressHex, encountered: 0x0`);
done();
});
provider.sendAsync(payload, callback);