Merge pull request #231 from SAP-samples/windows-test-fix

Avoid race condition in customer-handlers.test
This commit is contained in:
Heiko Witteborg
2021-05-14 13:41:17 +02:00
committed by GitHub

View File

@@ -6,13 +6,9 @@ else cds.User = cds.User.Privileged // hard core monkey patch for older cds rele
describe('Custom Handlers', () => { describe('Custom Handlers', () => {
it('should reject out-of-stock orders', async () => { it('should reject out-of-stock orders', async () => {
await expect( await POST('/browse/submitOrder', { book: 201, amount: 5 })
Promise.all([ await POST('/browse/submitOrder', { book: 201, amount: 5 })
POST('/browse/submitOrder', { book: 201, amount: 5 }), await expect(POST('/browse/submitOrder', { book: 201, amount: 5 })).to.be.rejectedWith(/409 - 5 exceeds stock for book #201/)
POST('/browse/submitOrder', { book: 201, amount: 5 }),
POST('/browse/submitOrder', { book: 201, amount: 5 }),
])
).to.be.rejectedWith(/409 - 5 exceeds stock for book #201/)
const { data } = await GET`/admin/Books/201/stock/$value` const { data } = await GET`/admin/Books/201/stock/$value`
expect(data).to.equal(2) expect(data).to.equal(2)
}) })