From c408a6a0dbb455e5f3e0b7a420d10b385b9ea411 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 17 Jun 2022 00:48:27 +0300 Subject: [PATCH] [#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 --- pkg/morph/client/netmap/netmap_test.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/morph/client/netmap/netmap_test.go b/pkg/morph/client/netmap/netmap_test.go index bb38e207a1..89989dfb36 100644 --- a/pkg/morph/client/netmap/netmap_test.go +++ b/pkg/morph/client/netmap/netmap_test.go @@ -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{