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

     1  package interopnames
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/require"
     7  )
     8  
     9  func TestFromID(t *testing.T) {
    10  	t.Run("Valid", func(t *testing.T) {
    11  		id := ToID([]byte(names[0]))
    12  		name, err := FromID(id)
    13  		require.NoError(t, err)
    14  		require.Equal(t, names[0], name)
    15  	})
    16  	t.Run("Invalid", func(t *testing.T) {
    17  		_, err := FromID(0x42424242)
    18  		require.ErrorIs(t, err, errNotFound)
    19  	})
    20  }