(t *testing.T)
| 109 | } |
| 110 | |
| 111 | func TestCreateQuery(t *testing.T) { |
| 112 | q := "CREATE (w:WorkPlace {name:'RedisLabs'})" |
| 113 | res, err := graph.Query(q) |
| 114 | if err != nil { |
| 115 | t.Error(err) |
| 116 | } |
| 117 | |
| 118 | assert.True(t, res.Empty(), "Expecting empty result-set") |
| 119 | |
| 120 | // Validate statistics. |
| 121 | assert.Equal(t, res.NodesCreated(), 1, "Expecting a single node to be created.") |
| 122 | assert.Equal(t, res.PropertiesSet(), 1, "Expecting a songle property to be added.") |
| 123 | |
| 124 | q = "MATCH (w:WorkPlace) RETURN w" |
| 125 | res, err = graph.Query(q) |
| 126 | if err != nil { |
| 127 | t.Error(err) |
| 128 | } |
| 129 | |
| 130 | assert.False(t, res.Empty(), "Expecting resultset to include a single node.") |
| 131 | res.Next() |
| 132 | r := res.Record() |
| 133 | w := r.GetByIndex(0).(*Node) |
| 134 | assert.Equal(t, w.Label, "WorkPlace", "Unexpected node label.") |
| 135 | } |
| 136 | |
| 137 | func TestCreateROQueryFailure(t *testing.T) { |
| 138 | q := "CREATE (w:WorkPlace {name:'RedisLabs'})" |
nothing calls this directly
no test coverage detected