Skip to content

Commit

Permalink
Update Business Network Connection (hyperledger-archives#3697)
Browse files Browse the repository at this point in the history
Allow a wallet to be configured through the api

contributes to hyperledger/composer#3618

Signed-off-by: Caroline Church <[email protected]>
  • Loading branch information
cazfletch authored and Simon Stone committed Mar 27, 2018
1 parent 73dd7d7 commit a2ec150
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/composer-client/lib/businessnetworkconnection.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class BusinessNetworkConnection extends EventEmitter {
LOG.entry(method, options);
options = options || {};

this.cardStore = options.cardStore || NetworkCardStoreManager.getCardStore();
this.cardStore = options.cardStore || NetworkCardStoreManager.getCardStore(options.wallet);
this.connectionProfileManager = new ConnectionProfileManager();
this.connection = null;
this.securityContext = null;
Expand Down
8 changes: 8 additions & 0 deletions packages/composer-client/test/businessnetworkconnection.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,14 @@ describe('BusinessNetworkConnection', () => {
should.equal(businessNetworkConnection.connection, null);
businessNetworkConnection.cardStore.should.equal(mockCardStore);
});

it('should create a new instance with a specified wallet', () => {
const wallet = {type:'composer-wallet-inmemory'};

businessNetworkConnection = new BusinessNetworkConnection({wallet : wallet});
should.equal(businessNetworkConnection.connection, null);
businessNetworkConnection.cardStore.should.be.an.instanceOf(BusinessNetworkCardStore);
});
});

describe('#connect', () => {
Expand Down

0 comments on commit a2ec150

Please sign in to comment.