From d8e42019a6466b40dbca838e1f3f47834904bd17 Mon Sep 17 00:00:00 2001 From: "Dr. David A. Kunz" Date: Thu, 24 Oct 2024 10:22:19 +0200 Subject: [PATCH 1/2] contains along associations --- test/compliance/SELECT.test.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/compliance/SELECT.test.js b/test/compliance/SELECT.test.js index 7a51129e5..9f2e3c79b 100644 --- a/test/compliance/SELECT.test.js +++ b/test/compliance/SELECT.test.js @@ -324,6 +324,11 @@ describe('SELECT', () => { await expect(cds.run(cqn)) .to.be.rejectedWith('Only foreign keys of “author” can be accessed in infix filter, but found “name”'); }) + test('exists with function in path expression', async () => { + const { Authors } = cds.entities('complex.associations') + const cqn = CQL`SELECT * FROM ${Authors} WHERE exists books[contains(title, ${'Wuthering'})]` + assert.strictEqual((await cds.run(cqn)).length, 1, 'Ensure that contains works in associations') + }) test('exists path expression (unmanaged)', async () => { const { Books } = cds.entities('complex.associations.unmanaged') From 1b677547e17592bdcd8a74534232ef9ae65ac611 Mon Sep 17 00:00:00 2001 From: "Dr. David A. Kunz" Date: Thu, 24 Oct 2024 10:37:02 +0200 Subject: [PATCH 2/2] . --- test/compliance/SELECT.test.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/compliance/SELECT.test.js b/test/compliance/SELECT.test.js index 9f2e3c79b..f5596c006 100644 --- a/test/compliance/SELECT.test.js +++ b/test/compliance/SELECT.test.js @@ -327,6 +327,9 @@ describe('SELECT', () => { test('exists with function in path expression', async () => { const { Authors } = cds.entities('complex.associations') const cqn = CQL`SELECT * FROM ${Authors} WHERE exists books[contains(title, ${'Wuthering'})]` + cqn.SELECT.where[1].ref[0].where.unshift('(') // as can originate from OData layer + cqn.SELECT.where[1].ref[0].where.push(')') + console.log(JSON.stringify(cqn.SELECT.where, null, 2)) assert.strictEqual((await cds.run(cqn)).length, 1, 'Ensure that contains works in associations') })