* Remove OData v2 show case: Genres TreeView * Refactored bookstore and fiori services: consolidate routing and remove deprecated files * Add Jest configuration file with silent mode enabled * Refactor test files: streamline imports and remove redundant code * Change price field type to Price for better clarity and precision * Example for separation of concerns: access-control.cds
16 lines
691 B
JavaScript
16 lines
691 B
JavaScript
const cds = require('@sap/cds')
|
|
const { GET, POST, expect } = cds.test(__dirname+'/../bookshop')
|
|
cds.User.default = cds.User.Privileged // hard core monkey patch
|
|
|
|
describe('cap/samples - Custom Handlers', () => {
|
|
|
|
it('should reject out-of-stock orders', async () => {
|
|
await expect(POST `/browse/submitOrder ${{ book: 201, quantity: 5 }}`).to.be.fulfilled
|
|
await expect(POST `/browse/submitOrder ${{ book: 201, quantity: 5 }}`).to.be.fulfilled
|
|
await expect(POST `/browse/submitOrder ${{ book: 201, quantity: 5 }}`).to.be.rejectedWith(
|
|
/409 - 5 exceeds stock for book #201/)
|
|
const { data } = await GET`/admin/Books/201/stock/$value`
|
|
expect(data).to.equal(2)
|
|
})
|
|
})
|