github.com/koko1123/flow-go-1@v0.29.6/module/blobs/blob_test.go (about)

     1  package blobs_test
     2  
     3  import (
     4  	"crypto/rand"
     5  	"testing"
     6  
     7  	"github.com/stretchr/testify/assert"
     8  
     9  	"github.com/koko1123/flow-go-1/module/blobs"
    10  )
    11  
    12  // TestBlobCIDLength tests that the CID length of a blob is equal to blobs.CidLength bytes.
    13  // If this test fails, it means that the default CID length of a blob has changed, probably
    14  // due to a change in the CID format used by our underlying dependencies.
    15  func TestBlobCIDLength(t *testing.T) {
    16  	data := make([]byte, 100)
    17  	_, _ = rand.Read(data)
    18  
    19  	assert.Equal(t, blobs.NewBlob(data).Cid().ByteLen(), blobs.CidLength)
    20  }