expect

package
v1.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 14, 2023 License: Apache-2.0 Imports: 8 Imported by: 3 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EventEqual

func EventEqual(event *peer.ChaincodeEvent, expected *mapping.Event, fromBytesConverters ...serialize.FromBytesConverter)

EventEqual expects that *peer.ChaincodeEvent stringer equal to mapping.Event

func EventIs

func EventIs(event *peer.ChaincodeEvent, expectName string, expectPayload interface{}, converter serialize.FromBytesConverter) interface{}

EventIs expects ChaincodeEvent name is equal to expectName and event payload can be marshaled to expectPayload

func EventPayloadEqual

func EventPayloadEqual(event *peer.ChaincodeEvent, expectedPayload interface{}, converter serialize.FromBytesConverter)

EventPayloadEqual checks event payload equality

func EventPayloadIs

func EventPayloadIs(event *peer.ChaincodeEvent, target interface{}, fromBytesConverters ...serialize.FromBytesConverter) interface{}

EventPayloadIs expects peer.ChaincodeEvent payload can be marshaled to target interface{} and returns converted value

func EventStringerEqual

func EventStringerEqual(event *peer.ChaincodeEvent, expectName string, expectPayload interface{}, fromBytesConverters ...serialize.FromBytesConverter)

EventStringerEqual expects ChaincodeEvent name is equal to expectName and event payload String() equal expectPayload String()

func JSONPayloadIs added in v1.0.2

func JSONPayloadIs(response peer.Response, target interface{}) interface{}

func PayloadBytes

func PayloadBytes(response peer.Response, expectedValue []byte) []byte

PayloadBytes expects response is ok and compares response.Payload with expected value

func PayloadInt

func PayloadInt(response peer.Response, expectedValue int) int

func PayloadIs

func PayloadIs(response peer.Response, target interface{}, fromBytesConverters ...serialize.FromBytesConverter) interface{}

PayloadIs expects peer.Response payload can be marshalled to target interface{} and returns converted value todo: fromBytesConverters temporaty optional

func PayloadString

func PayloadString(response peer.Response, expectedValue string) string

PayloadString expects payload content is string

func ResponseError

func ResponseError(response peer.Response, errMatcher ...interface{}) peer.Response

ResponseError expects peer.Response has shim.ERROR status and message has errMatcher matcher

func ResponseOk

func ResponseOk(response peer.Response, okMatcher ...interface{}) peer.Response

ResponseOk expects peer.Response has shim.OK status and message has okMatcher matcher

Types

type Stringer

type Stringer interface {
	String() string
}

type TxRes

type TxRes struct {
	Result interface{}
	Err    error
	Event  *peer.ChaincodeEvent
}

func (*TxRes) HasError

func (r *TxRes) HasError(err interface{}) *TxRes

func (*TxRes) HasNoError

func (r *TxRes) HasNoError() *TxRes

func (*TxRes) Is

func (r *TxRes) Is(expectedResult interface{}) *TxRes

func (*TxRes) ProduceEvent

func (r *TxRes) ProduceEvent(eventName string, eventPayload interface{}, fromBytesConverter serialize.FromBytesConverter) *TxRes

ProduceEvent expects that tx produces event with particular payload

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL