forked from onflow/flow-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
util_test.go
28 lines (23 loc) · 869 Bytes
/
util_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
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/utils/unittest"
)
func TestIsSporkRootSnapshot(t *testing.T) {
t.Run("spork root", func(t *testing.T) {
snapshot := unittest.RootSnapshotFixture(unittest.IdentityListFixture(10, unittest.WithAllRoles()))
isSporkRoot, err := protocol.IsSporkRootSnapshot(snapshot)
require.NoError(t, err)
assert.True(t, isSporkRoot)
})
t.Run("other snapshot", func(t *testing.T) {
snapshot := unittest.RootSnapshotFixture(unittest.IdentityListFixture(10, unittest.WithAllRoles()))
snapshot.Encodable().SealingSegment.Blocks = unittest.BlockFixtures(5)
isSporkRoot, err := protocol.IsSporkRootSnapshot(snapshot)
require.NoError(t, err)
assert.False(t, isSporkRoot)
})
}