graph-ecs/tests/query/return.test.js

24 lines
865 B
JavaScript
Raw Normal View History

2024-11-10 10:15:43 +01:00
import { describe, it } from 'node:test'
import assert from 'node:assert'
import { parse } from '../../src/parser.js'
import { statement } from '../../src/query/return.js'
describe('return parser', () => {
it('should collect a single value for a query to return', () => {
const result = parse(statement, 'RETURN folklore AS f')
console.log(result.error)
assert(result.isOk())
const [[selected]] = result.value
assert.deepStrictEqual(selected, ['folklore'])
})
//it('should collect multiple values for a query to return', () => {
// const result = parse(statement, 'RETURN sybil, mercury, rowan')
// console.log(result.error.state[0])
// assert(result.isOk())
// const [[selected]] = result.value
// assert.deepStrictEqual(selected, ['sybil', 'mercury', 'rowan'])
//})
})