fabric-samples/chaincode/fabcar/go/contract/shim.go
Brett Logan 23dc4e698a Add Tests to FabCar Go Chaincode
Many users raise questions on how to test chaincode. It used
to be much easier with the old shim, as they could directly
use the old mock stub in the shim. Now that it no longer exists
the fabcar example can provide an example of how to test chaincode.

Also worth noting is our current directory structure of our Go
chaincodes prevents the creation of mocks due to import cycles.
This change also pushes the chaincode logic down into a `contract`
package.

Signed-off-by: Brett Logan <brett.t.logan@ibm.com>
2020-07-06 15:05:07 -04:00

21 lines
665 B
Go

package contract
import (
"github.com/hyperledger/fabric-chaincode-go/shim"
"github.com/hyperledger/fabric-contract-api-go/contractapi"
)
//go:generate counterfeiter -o mocks/transaction.go -fake-name TransactionContext . TransactionContext
type TransactionContext interface {
contractapi.TransactionContextInterface
}
//go:generate counterfeiter -o mocks/chaincodestub.go -fake-name ChaincodeStub . ChaincodeStub
type ChaincodeStub interface {
shim.ChaincodeStubInterface
}
//go:generate counterfeiter -o mocks/statequeryiterator.go -fake-name StateQueryIterator . StateQueryIterator
type StateQueryIterator interface {
shim.StateQueryIteratorInterface
}