Skip to content

Fix Path unpacking when useBigInt is on #766

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion bolt-connection/src/packstream/packstream-v1.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
int,
isInt,
Integer,
toNumber,
Node,
Path,
PathSegment,
Expand Down Expand Up @@ -635,7 +636,7 @@ class Unpacker {

for (let i = 0; i < sequence.length; i += 2) {
const nextNode = nodes[sequence[i + 1]]
const relIndex = sequence[i]
const relIndex = toNumber(sequence[i])
let rel

if (relIndex > 0) {
Expand Down
39 changes: 39 additions & 0 deletions testkit-backend/src/cypher-native-binders.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,45 @@ export function nativeToCypher (x) {
}
return { name: 'CypherNode', data: node }
}
if (x instanceof neo4j.types.Relationship) {
const relationship = {
id: nativeToCypher(x.identity),
startNodeId: nativeToCypher(x.start),
endNodeId: nativeToCypher(x.end),
type: nativeToCypher(x.type),
props: nativeToCypher(x.properties)
}
return { name: 'CypherRelationship', data: relationship }
}
if (x instanceof neo4j.types.Path) {
const path = x.segments
.map(segment => {
return {
nodes: [segment.end],
relationships: [segment.relationship]
}
})
.reduce(
(previous, current) => {
return {
nodes: [...previous.nodes, ...current.nodes],
relationships: [
...previous.relationships,
...current.relationships
]
}
},
{ nodes: [x.start], relationships: [] }
)

return {
name: 'CypherPath',
data: {
nodes: nativeToCypher(path.nodes),
relationships: nativeToCypher(path.relationships)
}
}
}
// If all failed, interpret as a map
const map = {}
for (const [key, value] of Object.entries(x)) {
Expand Down
4 changes: 4 additions & 0 deletions testkit-backend/src/skipped-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ function skip (reason, ...predicate) {
}

const skippedTests = [
skip(
'Not support by the JS driver',
ifEquals('neo4j.sessionrun.TestSessionRun.test_partial_iteration')
),
skip(
'The driver has no support domain_name_resolver',
ifEndsWith('test_should_successfully_acquire_rt_when_router_ip_changes'),
Expand Down