Add test for nodes.Update()
This commit is contained in:
parent
603bd57b45
commit
a7479d5a19
@ -5,6 +5,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/FreifunkBremen/respond-collector/data"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -23,3 +24,18 @@ func TestLoadAndSave(t *testing.T) {
|
|||||||
|
|
||||||
assert.Equal(1, len(nodes.List))
|
assert.Equal(1, len(nodes.List))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestUpdateNodes(t *testing.T) {
|
||||||
|
assert := assert.New(t)
|
||||||
|
nodes := &Nodes{List: make(map[string]*Node)}
|
||||||
|
assert.Equal(0, len(nodes.List))
|
||||||
|
|
||||||
|
res := &data.ResponseData{
|
||||||
|
Neighbours: &data.Neighbours{},
|
||||||
|
Statistics: &data.Statistics{},
|
||||||
|
NodeInfo: &data.NodeInfo{},
|
||||||
|
}
|
||||||
|
nodes.Update("abcdef012345", res)
|
||||||
|
|
||||||
|
assert.Equal(1, len(nodes.List))
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user