Skip to content

Commit 0911f35

Browse files
committed
Add another path test
1 parent b59e17c commit 0911f35

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

dbms/src/test/java/org/polypheny/db/cypher/DmlInsertTest.java

+20
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,26 @@ public void insertSingleHopPathReturnPathTest() {
152152
}
153153

154154

155+
@Test
156+
public void insertSingleHopPathReturnPathTest2() {
157+
execute( "CREATE (p:Person {name: 'Max'})-[rel:OWNER_OF]->(a:Animal {name:'Kira', age:3, type:'dog'})" );
158+
GraphResult res = execute( "MATCH p = ()-[]->() RETURN p" );
159+
PolyPath p = PolyValue.fromTypedJson( res.getData()[0][0], PolyPath.class );
160+
assert p.getSegments().size() == 1;
161+
assert p.getNodes().size() == 2;
162+
assert p.getEdges().size() == 1;
163+
PolySegment s = p.getSegments().get( 0 );
164+
assert TestNode.from( List.of( "Person" ), Pair.of( "name", "Max" ) ).matches( p.getNodes().stream().filter( n -> n.id == s.sourceId ).findFirst().orElseThrow(), true );
165+
assert TestEdge.from( List.of( "OWNER_OF" ) ).matches( p.getEdges().stream().filter( e -> e.id == s.edgeId ).findFirst().orElseThrow(), true );
166+
assert TestNode.from(
167+
List.of( "Animal" ),
168+
Pair.of( "name", "Kira" ),
169+
Pair.of( "age", 3 ),
170+
Pair.of( "type", "dog" )
171+
).matches( p.getNodes().stream().filter( n -> n.id == s.targetId ).findFirst().orElseThrow(), true );
172+
}
173+
174+
155175
@Test
156176
public void insertMultipleHopPathTest() {
157177
execute( "CREATE (n:Person)-[f:FRIEND_OF]->(p:Person {name: 'Max'})-[rel:OWNER_OF]->(a:Animal {name:'Kira'})" );

0 commit comments

Comments
 (0)