From 952b2a6d36f9f964d1ea55c7a16668af0f4f9b6c Mon Sep 17 00:00:00 2001 From: "Ryan X. Charles" Date: Thu, 19 Jun 2014 12:34:05 -0700 Subject: [PATCH] add tests for WalletFactory --- test/test.WalletFactory.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/test.WalletFactory.js b/test/test.WalletFactory.js index f9098d8be..c9f8bde5c 100644 --- a/test/test.WalletFactory.js +++ b/test/test.WalletFactory.js @@ -169,4 +169,21 @@ describe('WalletFactory model', function() { }); }); + describe('#joinCreateSession', function() { + it('should call network.start', function() { + var wf = new WalletFactory(config, '0.0.1'); + wf.network.cleanUp = sinon.spy(); + wf.network.start = sinon.spy(); + wf.joinCreateSession('8WtTuiFTkhP5ao7AF2QErSwV39Cbur6pdMebKzQXFqL59RscXM', 'test', null, undefined); + wf.network.start.calledOnce.should.equal(true); + }); + it('should call network.start with private key', function() { + var wf = new WalletFactory(config, '0.0.1'); + wf.network.cleanUp = sinon.spy(); + wf.network.start = sinon.spy(); + wf.joinCreateSession('8WtTuiFTkhP5ao7AF2QErSwV39Cbur6pdMebKzQXFqL59RscXM', 'test', null, undefined); + wf.network.start.getCall(0).args[0].privkey.length.should.equal(64); //privkey is hex of private key buffer + }); + }); + });