github.com/anjalikarhana/fabric@v2.1.1+incompatible/common/capabilities/capabilities_test.go (about)

     1  /*
     2  Copyright IBM Corp. All Rights Reserved.
     3  
     4  SPDX-License-Identifier: Apache-2.0
     5  */
     6  
     7  package capabilities
     8  
     9  import (
    10  	"testing"
    11  
    12  	cb "github.com/hyperledger/fabric-protos-go/common"
    13  	"github.com/stretchr/testify/assert"
    14  )
    15  
    16  func TestSatisfied(t *testing.T) {
    17  	var capsMap map[string]*cb.Capability
    18  	for _, provider := range []*registry{
    19  		NewChannelProvider(capsMap).registry,
    20  		NewOrdererProvider(capsMap).registry,
    21  		NewApplicationProvider(capsMap).registry,
    22  	} {
    23  		assert.Nil(t, provider.Supported())
    24  	}
    25  }
    26  
    27  func TestNotSatisfied(t *testing.T) {
    28  	capsMap := map[string]*cb.Capability{
    29  		"FakeCapability": {},
    30  	}
    31  	for _, provider := range []*registry{
    32  		NewChannelProvider(capsMap).registry,
    33  		NewOrdererProvider(capsMap).registry,
    34  		NewApplicationProvider(capsMap).registry,
    35  	} {
    36  		assert.Error(t, provider.Supported())
    37  	}
    38  }