(t *testing.T)
| 237 | } |
| 238 | |
| 239 | func TestMap(t *testing.T) { |
| 240 | createGraph() |
| 241 | |
| 242 | q := "RETURN {val_1: 5, val_2: 'str', inner: {x: [1]}}" |
| 243 | res, err := graph.Query(q) |
| 244 | if err != nil { |
| 245 | t.Error(err) |
| 246 | } |
| 247 | res.Next() |
| 248 | r := res.Record() |
| 249 | mapval := r.GetByIndex(0).(map[string]interface{}) |
| 250 | |
| 251 | inner_map := map[string]interface{}{"x": []interface{}{1}} |
| 252 | expected := map[string]interface{}{"val_1": 5, "val_2": "str", "inner": inner_map} |
| 253 | assert.Equal(t, mapval, expected, "expecting a map literal") |
| 254 | |
| 255 | q = "MATCH (a:Country) RETURN a { .name }" |
| 256 | res, err = graph.Query(q) |
| 257 | if err != nil { |
| 258 | t.Error(err) |
| 259 | } |
| 260 | res.Next() |
| 261 | r = res.Record() |
| 262 | mapval = r.GetByIndex(0).(map[string]interface{}) |
| 263 | |
| 264 | expected = map[string]interface{}{"name": "Japan"} |
| 265 | assert.Equal(t, mapval, expected, "expecting a map projection") |
| 266 | } |
| 267 | |
| 268 | func TestPath(t *testing.T) { |
| 269 | createGraph() |
nothing calls this directly
no test coverage detected