Skip to content

Commit

Permalink
Add another path test
Browse files Browse the repository at this point in the history
  • Loading branch information
gartens committed Nov 7, 2024
1 parent c3b1c50 commit f696366
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions dbms/src/test/java/org/polypheny/db/cypher/DmlInsertTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,26 @@ public void insertSingleHopPathReturnPathTest() {
}


@Test
public void insertSingleHopPathReturnPathTest2() {
execute( "CREATE (p:Person {name: 'Max'})-[rel:OWNER_OF]->(a:Animal {name:'Kira', age:3, type:'dog'})" );
GraphResult res = execute( "MATCH p = ()-[]->() RETURN p" );
PolyPath p = PolyValue.fromTypedJson( res.getData()[0][0], PolyPath.class );
assert p.getSegments().size() == 1;
assert p.getNodes().size() == 2;
assert p.getEdges().size() == 1;
PolySegment s = p.getSegments().get( 0 );
assert TestNode.from( List.of( "Person" ), Pair.of( "name", "Max" ) ).matches( p.getNodes().stream().filter( n -> n.id == s.sourceId ).findFirst().orElseThrow(), true );
assert TestEdge.from( List.of( "OWNER_OF" ) ).matches( p.getEdges().stream().filter( e -> e.id == s.edgeId ).findFirst().orElseThrow(), true );
assert TestNode.from(
List.of( "Animal" ),
Pair.of( "name", "Kira" ),
Pair.of( "age", 3 ),
Pair.of( "type", "dog" )
).matches( p.getNodes().stream().filter( n -> n.id == s.targetId ).findFirst().orElseThrow(), true );
}


@Test
public void insertMultipleHopPathTest() {
execute( "CREATE (n:Person)-[f:FRIEND_OF]->(p:Person {name: 'Max'})-[rel:OWNER_OF]->(a:Animal {name:'Kira'})" );
Expand Down

0 comments on commit f696366

Please sign in to comment.