neo-go/pkg/core/interop/interopnames/convert_test.go
Roman Khimov 433275265f *: use require.ErrorIs instead of require.True(t, error.Is())
This is just a much better way to do the same thing. Inspired by
nspcc-dev/neofs-sdk-go#407.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2023-05-04 17:03:47 +03:00

20 lines
391 B
Go

package interopnames
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestFromID(t *testing.T) {
t.Run("Valid", func(t *testing.T) {
id := ToID([]byte(names[0]))
name, err := FromID(id)
require.NoError(t, err)
require.Equal(t, names[0], name)
})
t.Run("Invalid", func(t *testing.T) {
_, err := FromID(0x42424242)
require.ErrorIs(t, err, errNotFound)
})
}