github.com/nspcc-dev/neo-go@v0.105.2-0.20240517133400-6be757af3eba/pkg/core/native/nativenames_test.go (about)

     1  package native
     2  
     3  import (
     4  	"fmt"
     5  	"testing"
     6  
     7  	"github.com/nspcc-dev/neo-go/pkg/config"
     8  	"github.com/nspcc-dev/neo-go/pkg/core/native/nativenames"
     9  	"github.com/stretchr/testify/require"
    10  )
    11  
    12  func TestNativenamesIsValid(t *testing.T) {
    13  	// test that all native names have been added to IsValid
    14  	cfg := config.ProtocolConfiguration{P2PSigExtensions: true}
    15  	contracts := NewContracts(cfg)
    16  	for _, c := range contracts.Contracts {
    17  		require.True(t, nativenames.IsValid(c.Metadata().Name), fmt.Errorf("add %s to nativenames.IsValid(...)", c))
    18  	}
    19  
    20  	require.False(t, nativenames.IsValid("unknown"))
    21  }