40 lines
1.3 KiB
JavaScript
40 lines
1.3 KiB
JavaScript
import { describe, it } from 'node:test'
|
|
import assert from '../assert.js'
|
|
import { query } from '../../src/query/index.js'
|
|
import { Identifier, Query, ReturnValues } from '../../src/query/types.js'
|
|
import { makeEdge, makeNode } from '../utils.js'
|
|
|
|
const i = n => new Identifier(n)
|
|
const rv = (...v) => new ReturnValues(...v)
|
|
const q = (u, m, rv) => new Query(u, m, rv)
|
|
|
|
describe('query', () => {
|
|
//it('should match a node', () => {
|
|
// assert.parseOk(query, 'MATCH (node:Label) RETURN node', ([actual]) => {
|
|
// const expected = q(
|
|
// undefined, // no use clause
|
|
// makeNode('node', 'Label'),
|
|
// rv(i('node'))
|
|
// )
|
|
|
|
// assert.deepEqual(actual, expected)
|
|
// })
|
|
//})
|
|
|
|
it('should match a relationship', () => {
|
|
assert.parseOk(query, 'MATCH (rown:Creature)-[:PETPATS]->(kbity:NetCat) RETURN rown, kbity', (actual) => {
|
|
console.log(actual)
|
|
//const expected = q(
|
|
// undefined, // no use clause
|
|
// [
|
|
// makeNode('rown', 'Creature'),
|
|
// makeEdge(undefined, 'PETPATS'),
|
|
// makeNode('kbity', 'NetCat'),
|
|
// ],
|
|
// rv(i('rown'), i('kbity'))
|
|
//)
|
|
|
|
//assert.deepEqual(actual, expected)
|
|
})
|
|
})
|
|
})
|