github.com/koko1123/flow-go-1@v0.29.6/model/flow/factory/cluster_list_test.go (about)

     1  package factory_test
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/require"
     7  
     8  	"github.com/koko1123/flow-go-1/model/flow"
     9  	"github.com/koko1123/flow-go-1/model/flow/factory"
    10  	"github.com/koko1123/flow-go-1/utils/unittest"
    11  )
    12  
    13  // NewClusterList assumes the input assignments are sorted, and fail if not.
    14  // This tests verifies that NewClusterList has implemented the check on the assumption.
    15  func TestNewClusterListFail(t *testing.T) {
    16  	identities := unittest.IdentityListFixture(100, unittest.WithRole(flow.RoleCollection))
    17  	assignments := unittest.ClusterAssignment(10, identities)
    18  
    19  	tmp := assignments[1][0]
    20  	assignments[1][0] = assignments[1][1]
    21  	assignments[1][1] = tmp
    22  
    23  	_, err := factory.NewClusterList(assignments, identities)
    24  	require.Error(t, err)
    25  }