github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/model/flow/collection_test.go (about)

     1  package flow_test
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/assert"
     7  
     8  	"github.com/onflow/flow-go/model/encoding/rlp"
     9  	"github.com/onflow/flow-go/model/fingerprint"
    10  	"github.com/onflow/flow-go/model/flow"
    11  	"github.com/onflow/flow-go/utils/unittest"
    12  )
    13  
    14  func TestLightCollectionFingerprint(t *testing.T) {
    15  	col := unittest.CollectionFixture(2)
    16  	colID := col.ID()
    17  	data := fingerprint.Fingerprint(col.Light())
    18  	var decoded flow.LightCollection
    19  	rlp.NewMarshaler().MustUnmarshal(data, &decoded)
    20  	decodedID := decoded.ID()
    21  	assert.Equal(t, colID, decodedID)
    22  	assert.Equal(t, col.Light(), decoded)
    23  }