@@ -23,6 +23,7 @@ const NodeEventService = require('../lib/nodeeventservice');
2323const NodeHTTPService = require ( '../lib/nodehttpservice' ) ;
2424const NodeIdentityService = require ( '../lib/nodeidentityservice' ) ;
2525const ChaincodeStub = require ( 'fabric-shim/lib/stub' ) ;
26+ const ClientIdentity = require ( 'fabric-shim' ) . ClientIdentity ;
2627
2728require ( 'chai' ) . should ( ) ;
2829const sinon = require ( 'sinon' ) ;
@@ -51,7 +52,18 @@ XVMHPa0iyC497vdNURA=\
5152
5253 beforeEach ( ( ) => {
5354 mockStub = sinon . createStubInstance ( ChaincodeStub ) ;
54- mockStub . getCreator . returns ( cert ) ;
55+ mockStub . getCreator . returns ( {
56+ getMspid : ( ) => {
57+ return 'mspid' ;
58+ } ,
59+ getIdBytes : ( ) => {
60+ return {
61+ toBuffer : ( ) => {
62+ return cert ;
63+ }
64+ } ;
65+ }
66+ } ) ;
5567 mockStub . getTxID . returns ( '12345abcdefg' ) ;
5668 mockNodeContainer = sinon . createStubInstance ( NodeContainer ) ;
5769 mockEngine = sinon . createStubInstance ( Engine ) ;
@@ -115,7 +127,10 @@ XVMHPa0iyC497vdNURA=\
115127
116128 describe ( '#getNativeAPI' , ( ) => {
117129 it ( 'should return the native api' , ( ) => {
118- context . getNativeAPI ( ) . should . equal ( mockStub ) ;
130+ const api = context . getNativeAPI ( ) ;
131+ api . should . equal ( mockStub ) ;
132+ const clientIdentity = new api . _clientIdentityClass ( api ) ;
133+ clientIdentity . should . be . instanceOf ( ClientIdentity ) ;
119134 } ) ;
120135 } ) ;
121136} ) ;
0 commit comments