github.com/yacovm/fabric@v2.0.0-alpha.0.20191128145320-c5d4087dc723+incompatible/core/scc/scc_test.go (about) 1 /* 2 Copyright IBM Corp. All Rights Reserved. 3 4 SPDX-License-Identifier: Apache-2.0 5 */ 6 7 package scc_test 8 9 import ( 10 "testing" 11 12 "github.com/hyperledger/fabric/core/chaincode/lifecycle" 13 "github.com/hyperledger/fabric/core/scc" 14 "github.com/hyperledger/fabric/core/scc/mock" 15 "github.com/onsi/gomega" 16 ) 17 18 //go:generate counterfeiter -o mock/chaincode_stream_handler.go --fake-name ChaincodeStreamHandler . chaincodeStreamHandler 19 type chaincodeStreamHandler interface { 20 scc.ChaincodeStreamHandler 21 } 22 23 func TestDeploy(t *testing.T) { 24 gt := gomega.NewGomegaWithT(t) 25 26 csh := &mock.ChaincodeStreamHandler{} 27 doneC := make(chan struct{}) 28 close(doneC) 29 csh.LaunchInProcReturns(doneC) 30 scc.DeploySysCC(&lifecycle.SCC{}, csh) 31 gt.Expect(csh.LaunchInProcCallCount()).To(gomega.Equal(1)) 32 gt.Expect(csh.LaunchInProcArgsForCall(0)).To(gomega.Equal("_lifecycle.syscc")) 33 gt.Eventually(csh.HandleChaincodeStreamCallCount).Should(gomega.Equal(1)) 34 }