More cds.ql cleanup

This commit is contained in:
Daniel
2021-08-30 11:04:32 +02:00
committed by Daniel Hutzel
parent 46b58f1b5c
commit 2be3d50389

View File

@@ -13,9 +13,10 @@ describe('cds.ql → cqn', () => {
//
let cqn
describe.skip(`BUGS + GAPS...`, () => {
describe(`SELECT...`, () => {
it('should consistently handle *', () => {
if (!cdr) return
expect({
SELECT: { from: { ref: ['Foo'] }, columns: ['*'] },
})
@@ -25,19 +26,6 @@ describe('cds.ql → cqn', () => {
.to.eql(SELECT.from(Foo,['*']))
})
it('should consistently handle lists', () => {
const ID = 11, args = [`foo`, "'bar'", 3]
const cqn = CQL`SELECT from Foo where ID=11 and x in (foo,'bar',3)`
expect(SELECT.from(Foo).where(`ID=${ID} and x in (${args})`)).to.eql(cqn)
expect(SELECT.from(Foo).where(`ID=`, ID, `and x in`, args)).to.eql(cqn)
expect(SELECT.from(Foo).where({ ID, x:args })).to.eql(cqn)
})
})
describe(`SELECT...`, () => {
test('from ( Foo )', () => {
expect({
SELECT: { from: { ref: ['Foo'] } },
@@ -390,6 +378,15 @@ describe('cds.ql → cqn', () => {
)
})
it('should consistently handle lists', () => {
if (!cdr) return
const ID = 11, args = [{ref:['foo']}, "bar", 3]
const cqn = CQL`SELECT from Foo where ID=11 and x in (foo,'bar',3)`
expect(SELECT.from(Foo).where`ID=${ID} and x in ${args}`).to.eql(cqn)
expect(SELECT.from(Foo).where(`ID=`, ID, `and x in`, args)).to.eql(cqn)
expect(SELECT.from(Foo).where({ ID, x:args })).to.eql(cqn)
})
test('w/ sub selects', () => {
// in where causes
expect(SELECT.from(Foo).where({ x: SELECT('y').from('Bar') })).to.eql(