Skip to content

Commit

Permalink
test: compare contains result to boolean explicitly
Browse files Browse the repository at this point in the history
  • Loading branch information
PDT42 committed Jan 15, 2025
1 parent 85621ad commit 47a8bcf
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/scenarios/bookshop/funcs.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,24 @@ describe('Bookshop - Functions', () => {
expect(res.data.value.length).to.be.eq(2)
})

test('contains with explicit equals boolean value', async () => {
const res = await GET("/browse/Books?$filter=contains(author,'Allen') eq true")
expect(res.status).to.be.eq(200)
expect(res.data.value.length).to.be.eq(2)
})

test('contains with explicit not equals boolean value', async () => {
const res = await GET("/browse/Books?$filter=contains(author,'Allen') ne false")
expect(res.status).to.be.eq(200)
expect(res.data.value.length).to.be.eq(2)
})

test('not contains with explicit equals boolean value', async () => {
const res = await GET("/browse/Books?$filter=not contains(author,'Allen') eq false")
expect(res.status).to.be.eq(200)
expect(res.data.value.length).to.be.eq(2)
})

test('avg', async () => {
const { Books } = cds.entities
const res = await cds.run(CQL`SELECT from ${Books} {
Expand Down

0 comments on commit 47a8bcf

Please sign in to comment.