frostfs-node/pkg/morph/event/rolemanagement/designate_test.go
Evgenii Stratonikov 2e31cd34e6 [#502] innerring: synchronize validators on mainnet alphabet update
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-05-25 11:10:01 +03:00

27 lines
802 B
Go

package rolemanagement
import (
"testing"
"github.com/nspcc-dev/neo-go/pkg/core/native/noderoles"
"github.com/nspcc-dev/neo-go/pkg/vm/stackitem"
"github.com/stretchr/testify/require"
)
func TestParseRoleUpdate(t *testing.T) {
t.Run("wrong number of arguments", func(t *testing.T) {
_, err := ParseDesignate([]stackitem.Item{})
require.Error(t, err)
})
t.Run("invalid item type", func(t *testing.T) {
args := []stackitem.Item{stackitem.NewMap(), stackitem.Make(123)}
_, err := ParseDesignate(args)
require.Error(t, err)
})
t.Run("good", func(t *testing.T) {
args := []stackitem.Item{stackitem.Make(int(noderoles.NeoFSAlphabet)), stackitem.Make(123)}
e, err := ParseDesignate(args)
require.NoError(t, err)
require.Equal(t, noderoles.NeoFSAlphabet, e.(Designate).Role)
})
}