github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/utils/unittest/incorporated_results.go (about)

     1  package unittest
     2  
     3  import "github.com/onflow/flow-go/model/flow"
     4  
     5  var IncorporatedResult incorporatedResultFactory
     6  
     7  type incorporatedResultFactory struct{}
     8  
     9  func (f *incorporatedResultFactory) Fixture(opts ...func(*flow.IncorporatedResult)) *flow.IncorporatedResult {
    10  	result := ExecutionResultFixture()
    11  	incorporatedBlockID := IdentifierFixture()
    12  	ir := flow.NewIncorporatedResult(incorporatedBlockID, result)
    13  
    14  	for _, apply := range opts {
    15  		apply(ir)
    16  	}
    17  	return ir
    18  }
    19  
    20  func (f *incorporatedResultFactory) WithResult(result *flow.ExecutionResult) func(*flow.IncorporatedResult) {
    21  	return func(incResult *flow.IncorporatedResult) {
    22  		incResult.Result = result
    23  	}
    24  }
    25  
    26  func (f *incorporatedResultFactory) WithIncorporatedBlockID(id flow.Identifier) func(*flow.IncorporatedResult) {
    27  	return func(incResult *flow.IncorporatedResult) {
    28  		incResult.IncorporatedBlockID = id
    29  	}
    30  }