add test for polycule
This commit is contained in:
parent
5411742372
commit
523a64869a
1 changed files with 37 additions and 1 deletions
|
@ -67,12 +67,24 @@ describe('edge', () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('MATCH keyword', () => {
|
describe('MATCH keyword', () => {
|
||||||
it('should match nodes with a relationship to another another node', () => {
|
it('should match a single node with no relationships', () => {
|
||||||
|
assert.parseOk(statement, 'MATCH (:Label)', ([actual]) => {
|
||||||
|
const expected = makeNode(undefined, 'Label')
|
||||||
|
assert.deepEqual(actual, expected)
|
||||||
|
})
|
||||||
|
|
||||||
assert.parseOk(statement, 'MATCH (node:Label)', ([actual]) => {
|
assert.parseOk(statement, 'MATCH (node:Label)', ([actual]) => {
|
||||||
const expected = makeNode('node', 'Label')
|
const expected = makeNode('node', 'Label')
|
||||||
assert.deepEqual(actual, expected)
|
assert.deepEqual(actual, expected)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
assert.parseOk(statement, 'MATCH (node:Label { prop: true, value: "test" })', ([actual]) => {
|
||||||
|
const expected = makeNode('node', 'Label', [['prop', true], ['value', 'test']])
|
||||||
|
assert.deepEqual(actual, expected)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should match nodes with a relationship to another another node', () => {
|
||||||
assert.parseOk(statement, 'MATCH (:Node)-[:Edge]->(:Node)', actual => {
|
assert.parseOk(statement, 'MATCH (:Node)-[:Edge]->(:Node)', actual => {
|
||||||
const expected = [
|
const expected = [
|
||||||
makeNode(undefined, 'Node'),
|
makeNode(undefined, 'Node'),
|
||||||
|
@ -102,6 +114,30 @@ describe('MATCH keyword', () => {
|
||||||
|
|
||||||
assert.deepEqual(actual, expected)
|
assert.deepEqual(actual, expected)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
assert.parseOk(statement, 'MATCH (:Node { db: 0.7 })-[:Edge]->(:Node { db: 0.95 })', actual => {
|
||||||
|
const expected = [
|
||||||
|
makeNode(undefined, 'Node', [['db', 0.7]]),
|
||||||
|
makeEdge(undefined, 'Edge'),
|
||||||
|
makeNode(undefined, 'Node', [['db', 0.95]]),
|
||||||
|
]
|
||||||
|
|
||||||
|
assert.deepEqual(actual, expected)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should handle multiple relationships', () => {
|
||||||
|
assert.parseOk(statement, 'MATCH (player:Player)-[:Knows]->(a:NPC)-[:Knows]->(b:NPC)', actual => {
|
||||||
|
const expected = [
|
||||||
|
makeNode('player', 'Player'),
|
||||||
|
makeEdge(undefined, 'Knows'),
|
||||||
|
makeNode('a', 'NPC'),
|
||||||
|
makeEdge(undefined, 'Knows'),
|
||||||
|
makeNode('b', 'NPC'),
|
||||||
|
]
|
||||||
|
|
||||||
|
assert.deepEqual(actual, expected)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue