github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/engine/common/rpc/convert/headers_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/utils/unittest" 11 ) 12 13 // TestConvertBlockHeader tests that converting a header to and from a protobuf message results in the same 14 // header 15 func TestConvertBlockHeader(t *testing.T) { 16 t.Parallel() 17 18 header := unittest.BlockHeaderFixture() 19 20 signerIDs := unittest.IdentifierListFixture(5) 21 22 msg, err := convert.BlockHeaderToMessage(header, signerIDs) 23 require.NoError(t, err) 24 25 converted, err := convert.MessageToBlockHeader(msg) 26 require.NoError(t, err) 27 28 assert.Equal(t, header, converted) 29 }