From a22d8fc6c456f7a5c76c5b1a51e6a1f56e2b629e Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Wed, 8 May 2019 16:35:48 -0400 Subject: [PATCH] fix(test): fix accountParser test in regards to privateKey fix --- packages/embark/src/test/accountParser.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/embark/src/test/accountParser.js b/packages/embark/src/test/accountParser.js index c51f18c6d..c1a8050bd 100644 --- a/packages/embark/src/test/accountParser.js +++ b/packages/embark/src/test/accountParser.js @@ -13,7 +13,6 @@ describe('embark.AccountParser', function () { let web3; let testLogger; let isHexStrictStub; - before(() => { testLogger = new TestLogger({}); web3 = { @@ -26,7 +25,6 @@ describe('embark.AccountParser', function () { } }; isHexStrictStub = sinon.stub(Web3.utils, 'isHexStrict').returns(true); - // Web3.utils.isHexStrict = sinon.stub().returns(true); }); after(() => { @@ -38,18 +36,21 @@ describe('embark.AccountParser', function () { privateKey: 'myKey' }, web3, fs.dappPath(), testLogger); - assert.deepEqual(account, {key: Buffer.from('myKey', 'hex'), hexBalance: null}); + assert.deepEqual(account, {key: '0xmyKey', hexBalance: null}); }); it('should return two accounts from the keys in the file', function () { + const sameFs = require('fs'); + const readFileSyncStub = sinon.stub(sameFs, 'readFileSync').returns('key1;key2'); const account = AccountParser.getAccount({ privateKeyFile: 'keyFiles/twoKeys' }, web3, fs.dappPath(), testLogger); assert.deepEqual(account, [ - {key: Buffer.from('key1', 'hex'), hexBalance: null}, - {key: Buffer.from('key2', 'hex'), hexBalance: null} + {key:'0xkey1', hexBalance: null}, + {key: '0xkey2', hexBalance: null} ]); + readFileSyncStub.restore(); }); it('should return one account from the mnemonic', function () {