graph-ecs/tests/query-parser/use.test.js

18 lines
564 B
JavaScript
Raw Normal View History

2024-11-10 10:15:43 +01:00
import { describe, it } from 'node:test'
2024-11-13 20:24:29 +01:00
import assert from '../assert.js'
2024-11-20 20:21:41 +01:00
import { useClause } from '../../src/query-parser/use.js'
import { Identifier } from '../../src/query-parser/types.js'
2024-11-10 10:15:43 +01:00
2024-11-14 00:32:46 +01:00
describe('USE keyword', () => {
2024-11-10 10:15:43 +01:00
it('should select a graph to query', () => {
2024-11-18 23:06:58 +01:00
assert.parseOk(useClause, 'USE default', ([actual]) => {
2024-11-13 20:24:29 +01:00
assert.deepEqual(actual.identifier, new Identifier('default'))
})
2024-11-10 10:15:43 +01:00
})
it('should return an error if no graph identifier is provided', () => {
2024-11-18 23:06:58 +01:00
assert.parseErr(useClause, 'USE')
2024-11-10 10:15:43 +01:00
})
})