Change connections storage from arr to map
This commit is contained in:
@@ -31,7 +31,7 @@ func TestOneMarshalBSON(t *testing.T) {
|
||||
one: (One{Name: "hello", Type: "world", Modified: 1}),
|
||||
},
|
||||
"w/ connections": {
|
||||
one: (One{Name: "hello", Type: "world", Modified: 1, Connections: []One{One{Name: "hi", Relationship: "mom"}}}),
|
||||
one: (One{Name: "hello", Type: "world", Modified: 1, Connections: map[string]One{"hi": One{Name: "hi", Relationship: "mom"}}}),
|
||||
},
|
||||
}
|
||||
|
||||
@@ -56,8 +56,10 @@ func TestOneMarshalBSON(t *testing.T) {
|
||||
}
|
||||
c.one.Modified = 0
|
||||
one.Modified = 0
|
||||
for i := range one.Connections {
|
||||
one.Connections[i].Modified = 0
|
||||
for k := range one.Connections {
|
||||
temp := one.Connections[k]
|
||||
temp.Modified = 0
|
||||
one.Connections[k] = temp
|
||||
}
|
||||
if fmt.Sprint(c.one) != fmt.Sprint(one) {
|
||||
t.Error(c.one, one)
|
||||
|
||||
Reference in New Issue
Block a user