(t *testing.T, res *QueryResult)
| 79 | } |
| 80 | |
| 81 | func checkQueryResults(t *testing.T, res *QueryResult) { |
| 82 | assert.Equal(t, len(res.results), 1, "expecting 1 result record") |
| 83 | |
| 84 | res.Next() |
| 85 | r := res.Record() |
| 86 | |
| 87 | s, ok := r.GetByIndex(0).(*Node) |
| 88 | assert.True(t, ok, "First column should contain nodes.") |
| 89 | e, ok := r.GetByIndex(1).(*Edge) |
| 90 | assert.True(t, ok, "Second column should contain edges.") |
| 91 | d, ok := r.GetByIndex(2).(*Node) |
| 92 | assert.True(t, ok, "Third column should contain nodes.") |
| 93 | |
| 94 | assert.Equal(t, s.Label, "Person", "Node should be of type 'Person'") |
| 95 | assert.Equal(t, e.Relation, "Visited", "Edge should be of relation type 'Visited'") |
| 96 | assert.Equal(t, d.Label, "Country", "Node should be of type 'Country'") |
| 97 | |
| 98 | assert.Equal(t, len(s.Properties), 4, "Person node should have 4 properties") |
| 99 | |
| 100 | assert.Equal(t, s.GetProperty("name"), "John Doe", "Unexpected property value.") |
| 101 | assert.Equal(t, s.GetProperty("age"), 33, "Unexpected property value.") |
| 102 | assert.Equal(t, s.GetProperty("gender"), "male", "Unexpected property value.") |
| 103 | assert.Equal(t, s.GetProperty("status"), "single", "Unexpected property value.") |
| 104 | |
| 105 | assert.Equal(t, e.GetProperty("year"), 2017, "Unexpected property value.") |
| 106 | |
| 107 | assert.Equal(t, d.GetProperty("name"), "Japan", "Unexpected property value.") |
| 108 | assert.Equal(t, d.GetProperty("population"), 126800000, "Unexpected property value.") |
| 109 | } |
| 110 | |
| 111 | func TestCreateQuery(t *testing.T) { |
| 112 | q := "CREATE (w:WorkPlace {name:'RedisLabs'})" |
no test coverage detected