package policer

import (
	"testing"

	netmaptest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap/test"
	"github.com/stretchr/testify/require"
)

func TestNodeCache(t *testing.T) {
	cache := newNodeCache()
	node := netmaptest.NodeInfo()

	require.Equal(t, cache.processStatus(node), nodeNotProcessed)

	cache.SubmitSuccessfulReplication(node)
	require.Equal(t, cache.processStatus(node), nodeHoldsObject)

	cache.submitReplicaCandidate(node)
	require.Equal(t, cache.processStatus(node), nodeDoesNotHoldObject)

	cache.submitReplicaHolder(node)
	require.Equal(t, cache.processStatus(node), nodeHoldsObject)
}