Add test for nodes.Update()

This commit is contained in:
Julian Kornberger 2016-03-21 12:26:08 +01:00
parent 603bd57b45
commit a7479d5a19

View File

@ -5,6 +5,7 @@ import (
"os"
"testing"
"github.com/FreifunkBremen/respond-collector/data"
"github.com/stretchr/testify/assert"
)
@ -23,3 +24,18 @@ func TestLoadAndSave(t *testing.T) {
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))
}