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: list inside path expression #428

Closed
wants to merge 5 commits into from
Closed
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
30 changes: 30 additions & 0 deletions db-service/test/cqn4sql/path-in-from.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,34 @@ describe('infix filter on entities', () => {
let query = cqn4sql(CQL`SELECT from bookshop.Books[author.ID = 22] {Books.ID}`, model)
expect(query).to.deep.equal(CQL`SELECT from bookshop.Books as Books {Books.ID} WHERE Books.author_ID = 22`)
})
it('list in where', () => {
const select = SELECT.from({ ref: ['bookshop.Books'] }).where([
{ list: [{ ref: ['ID'] }] },
'in',
SELECT.from({ ref: ['bookshop.Books'] }).where([{ ref: ['ID'] }, '=', { val: 5 }]),
])
let query = cqn4sql(select, model)
expect(query).to.not.be.undefined
})

// TO FIX
it('list in where in ref', () => {
const select = SELECT.from({
ref: [
{
id: 'bookshop.Books',
where: [
{ list: [{ ref: ['ID'] }] },
'in',
SELECT.from({ ref: ['bookshop.Books'] }).where([{ ref: ['ID'] }, '=', { val: 5 }]),
],
},
],
})

expect(() => {
cqn4sql(select, model)
}).to.throw()
throw new Error('list in where in ref fails');
})
})
Loading