github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/state/protocol/convert_test.go (about) 1 package protocol_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/state/protocol" 10 "github.com/onflow/flow-go/state/protocol/inmem" 11 "github.com/onflow/flow-go/utils/unittest" 12 ) 13 14 func TestToEpochSetup(t *testing.T) { 15 expected := unittest.EpochSetupFixture() 16 epoch := inmem.NewSetupEpoch(expected) 17 18 got, err := protocol.ToEpochSetup(epoch) 19 require.NoError(t, err) 20 assert.True(t, expected.EqualTo(got)) 21 } 22 23 func TestToEpochCommit(t *testing.T) { 24 setup := unittest.EpochSetupFixture() 25 expected := unittest.EpochCommitFixture( 26 unittest.CommitWithCounter(setup.Counter), 27 unittest.WithDKGFromParticipants(setup.Participants), 28 unittest.WithClusterQCsFromAssignments(setup.Assignments)) 29 epoch := inmem.NewCommittedEpoch(setup, expected) 30 31 got, err := protocol.ToEpochCommit(epoch) 32 require.NoError(t, err) 33 assert.True(t, expected.EqualTo(got)) 34 }