From 2be3d50389f4ba6eca68546a77654cc640f3b92d Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 30 Aug 2021 11:04:32 +0200 Subject: [PATCH] More cds.ql cleanup --- test/cds.ql.test.js | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/test/cds.ql.test.js b/test/cds.ql.test.js index e38d3b39..b6d23c6e 100644 --- a/test/cds.ql.test.js +++ b/test/cds.ql.test.js @@ -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(