forked from TrueCloudLab/frostfs-node
[#1513] morph/netmap: Use constant states in unit tests
Use values of the node state enumeration from Netmap contract instead of numeric literals. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
eb7b8bf7c4
commit
c408a6a0db
1 changed files with 5 additions and 4 deletions
|
@ -7,6 +7,7 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/nspcc-dev/neo-go/pkg/vm/stackitem"
|
||||
netmapcontract "github.com/nspcc-dev/neofs-contract/netmap"
|
||||
"github.com/nspcc-dev/neofs-sdk-go/netmap"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
@ -18,9 +19,9 @@ func Test_stackItemsToNodeInfos(t *testing.T) {
|
|||
rand.Read(pub)
|
||||
|
||||
switch i % 3 {
|
||||
case 1:
|
||||
case int(netmapcontract.OfflineState):
|
||||
expected[i].SetOffline()
|
||||
case 2:
|
||||
case int(netmapcontract.OnlineState):
|
||||
expected[i].SetOnline()
|
||||
}
|
||||
|
||||
|
@ -37,9 +38,9 @@ func Test_stackItemsToNodeInfos(t *testing.T) {
|
|||
|
||||
switch {
|
||||
case expected[i].IsOnline():
|
||||
state = 1
|
||||
state = int64(netmapcontract.OnlineState)
|
||||
case expected[i].IsOffline():
|
||||
state = 2
|
||||
state = int64(netmapcontract.OfflineState)
|
||||
}
|
||||
|
||||
items[i] = stackitem.NewStruct([]stackitem.Item{
|
||||
|
|
Loading…
Reference in a new issue