Skip to content

Commit a325fb3

Browse files
committed
fixed PR comments
1 parent d2e47be commit a325fb3

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

client_test.go

+13-11
Original file line numberDiff line numberDiff line change
@@ -176,19 +176,21 @@ func TestArray(t *testing.T) {
176176

177177
assert.Equal(t, 2, len(arr))
178178

179-
res_a := arr[0].(*Node)
180-
res_b := arr[1].(*Node)
181-
if res_a.GetProperty("name") != "a" {
182-
res_a = arr[1].(*Node)
183-
res_b = arr[0].(*Node)
179+
resA := arr[0].(*Node)
180+
resB := arr[1].(*Node)
181+
// the order of values in the array returned by collect operation is not defined
182+
// check for the node that contains the name "a" and set it to be resA
183+
if resA.GetProperty("name") != "a" {
184+
resA = arr[1].(*Node)
185+
resB = arr[0].(*Node)
184186
}
185187

186-
assert.Equal(t, a.GetProperty("name"), res_a.GetProperty("name"), "Unexpected property value.")
187-
assert.Equal(t, a.GetProperty("age"), res_a.GetProperty("age"), "Unexpected property value.")
188-
assert.Equal(t, a.GetProperty("array"), res_a.GetProperty("array"), "Unexpected property value.")
188+
assert.Equal(t, a.GetProperty("name"), resA.GetProperty("name"), "Unexpected property value.")
189+
assert.Equal(t, a.GetProperty("age"), resA.GetProperty("age"), "Unexpected property value.")
190+
assert.Equal(t, a.GetProperty("array"), resA.GetProperty("array"), "Unexpected property value.")
189191

190-
assert.Equal(t, b.GetProperty("name"), res_b.GetProperty("name"), "Unexpected property value.")
191-
assert.Equal(t, b.GetProperty("age"), res_b.GetProperty("age"), "Unexpected property value.")
192-
assert.Equal(t, b.GetProperty("array"), res_b.GetProperty("array"), "Unexpected property value.")
192+
assert.Equal(t, b.GetProperty("name"), resB.GetProperty("name"), "Unexpected property value.")
193+
assert.Equal(t, b.GetProperty("age"), resB.GetProperty("age"), "Unexpected property value.")
194+
assert.Equal(t, b.GetProperty("array"), resB.GetProperty("array"), "Unexpected property value.")
193195

194196
}

0 commit comments

Comments
 (0)