github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/engine/common/rpc/convert/snapshots_test.go (about)

     1  package convert_test
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/assert"
     7  	"github.com/stretchr/testify/require"
     8  
     9  	"github.com/onflow/flow-go/engine/common/rpc/convert"
    10  	"github.com/onflow/flow-go/model/flow"
    11  	"github.com/onflow/flow-go/utils/unittest"
    12  )
    13  
    14  func TestConvertSnapshot(t *testing.T) {
    15  	t.Parallel()
    16  
    17  	identities := unittest.CompleteIdentitySet()
    18  	snapshot := unittest.RootSnapshotFixtureWithChainID(identities, flow.Testnet.Chain().ChainID())
    19  
    20  	msg, err := convert.SnapshotToBytes(snapshot)
    21  	require.NoError(t, err)
    22  
    23  	converted, err := convert.BytesToInmemSnapshot(msg)
    24  	require.NoError(t, err)
    25  
    26  	assert.Equal(t, snapshot, converted)
    27  }