mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-04 19:19:44 +00:00
22 lines
409 B
Go
22 lines
409 B
Go
|
package interopnames
|
||
|
|
||
|
import (
|
||
|
"errors"
|
||
|
"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.True(t, errors.Is(err, errNotFound))
|
||
|
})
|
||
|
}
|