alexgraul commented on issue #221:
URL: https://github.com/apache/age/issues/221#issuecomment-2287531745
I think I've run into the same issue, but I can replicate with a much
simpler case for replication:
To confirm this is a parsing issue I used this query to generate the test
string:
```
SELECT *
FROM cypher('testing_graph', $$
CREATE (c:car { name: '4wd', wheels: ["a",["d"]] })
RETURN c
$$) as (c agtype);
```
Returns
`{"id": 1125899906842627, "label": "car", "properties": {"name": "4wd",
"wheels": ["a", ["d"]]}}::vertex`
The following test case added to `drivers/nodejs/nodejs/test/Agtype.test.ts`
will fail:
```
test('Nested Array Parsing', () => {
expect(AGTypeParse('{"id": 1125899906842627, "label": "car",
"properties": {"name": "4wd", "wheels": [ "a", ["d"]
]}}::vertex').get('id')).toBe(1125899906842627)
expect(AGTypeParse('{"id": 1125899906842627, "label": "car",
"properties": {"name": "4wd", "wheels": [ "a", ["d"]
]}}::vertex')).toStrictEqual(new Map<string, any>(Object.entries({
id: 1125899906842627,
label: 'car',
properties: new Map(Object.entries({ name: '4wd', wheels: ['a', ['d']]
}))
}));
})
```
The first `expect` is there just to confirm the return Map is completely
malformed rather than a minor quirk causing `StringEquals` to fail.
The object that does come back looks like this:
`Map(2) { 'name' => '4wd', 'properties' => [ 'a', [ 'd' ] ] }`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]