Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: contains along associations #863

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions test/compliance/SELECT.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,14 @@
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'})]`
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))

Check warning on line 332 in test/compliance/SELECT.test.js

View workflow job for this annotation

GitHub Actions / Tests (22)

Unexpected console statement
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')
Expand Down
Loading