Skip to content

Commit

Permalink
chore: reorganize compliance tests to always use same models (#331)
Browse files Browse the repository at this point in the history
  • Loading branch information
johannes-vogel authored Nov 2, 2023
1 parent a788a77 commit 95b6ee9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
18 changes: 2 additions & 16 deletions test/compliance/DELETE.test.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,13 @@
'use strict'

const cds = require('../cds.js')

describe('DELETE', () => {
cds.test(__dirname + '/../bookshop')

describe('from', () => {
test.skip('missing', () => {
throw new Error('not supported')
})
})

describe('where', () => {
test.skip('path expressions', async () => {
const deleteEmilysBooks = DELETE.from('AdminService.RenameKeys').where(`author.name = 'Emily Brontë'`)
const selectEmilysBooks = CQL`SELECT * FROM sap.capire.bookshop.Books where author.name = 'Emily Brontë'`

const beforeDelete = await cds.run(selectEmilysBooks)
await cds.run(deleteEmilysBooks)
const afterDelete = await cds.run(selectEmilysBooks)

expect(beforeDelete).toHaveLength(1)
expect(afterDelete).toHaveLength(0)
test.skip('missing', () => {
throw new Error('not supported')
})
})
})
12 changes: 12 additions & 0 deletions test/scenarios/bookshop/delete.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,16 @@ describe('Bookshop - Delete', () => {
const del = DELETE.from('sap.capire.bookshop.A').where('ID = 1')
await expect(cds.db.run(del)).to.be.eventually.rejectedWith('Transitive circular composition detected')
})

test.skip('Delete with path expressions', async () => {
const deleteEmilysBooks = DELETE.from('AdminService.RenameKeys').where(`author.name = 'Emily'`)
const selectEmilysBooks = CQL`SELECT * FROM AdminService.Books where author.name = 'Emily'`

const beforeDelete = await cds.run(selectEmilysBooks)
await cds.run(deleteEmilysBooks)
const afterDelete = await cds.run(selectEmilysBooks)

expect(beforeDelete).toHaveLength(1)
expect(afterDelete).toHaveLength(0)
})
})

0 comments on commit 95b6ee9

Please sign in to comment.