-
Notifications
You must be signed in to change notification settings - Fork 180
/
Copy pathconvert_test.go
34 lines (27 loc) · 946 Bytes
/
convert_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package protocol_test
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/onflow/flow-go/state/protocol"
"github.com/onflow/flow-go/state/protocol/inmem"
"github.com/onflow/flow-go/utils/unittest"
)
func TestToEpochSetup(t *testing.T) {
expected := unittest.EpochSetupFixture()
epoch := inmem.NewSetupEpoch(expected, nil)
got, err := protocol.ToEpochSetup(epoch)
require.NoError(t, err)
assert.True(t, expected.EqualTo(got))
}
func TestToEpochCommit(t *testing.T) {
setup := unittest.EpochSetupFixture()
expected := unittest.EpochCommitFixture(
unittest.CommitWithCounter(setup.Counter),
unittest.WithDKGFromParticipants(setup.Participants),
unittest.WithClusterQCsFromAssignments(setup.Assignments))
epoch := inmem.NewCommittedEpoch(setup, nil, expected)
got, err := protocol.ToEpochCommit(epoch)
require.NoError(t, err)
assert.True(t, expected.EqualTo(got))
}