Add one more unit test
This commit is contained in:
parent
a75540cec6
commit
fa18c0def4
|
@ -64,7 +64,7 @@ func TestLimitIterator_ScoreThreshold(t *testing.T) {
|
|||
}
|
||||
|
||||
var nodes []*structs.Node
|
||||
for i := 0; i < 10; i++ {
|
||||
for i := 0; i < 5; i++ {
|
||||
nodes = append(nodes, mock.Node())
|
||||
}
|
||||
|
||||
|
@ -270,6 +270,32 @@ func TestLimitIterator_ScoreThreshold(t *testing.T) {
|
|||
limit: 2,
|
||||
maxSkip: 2,
|
||||
},
|
||||
{
|
||||
desc: "maxSkip is more than available nodes",
|
||||
nodes: []*RankedNode{
|
||||
{
|
||||
Node: nodes[0],
|
||||
Score: -2,
|
||||
},
|
||||
{
|
||||
Node: nodes[1],
|
||||
Score: 1,
|
||||
},
|
||||
},
|
||||
expectedOut: []*RankedNode{
|
||||
{
|
||||
Node: nodes[1],
|
||||
Score: 1,
|
||||
},
|
||||
{
|
||||
Node: nodes[0],
|
||||
Score: -2,
|
||||
},
|
||||
},
|
||||
threshold: -1,
|
||||
limit: 2,
|
||||
maxSkip: 10,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
|
|
Loading…
Reference in a new issue