Cleaned up tests

This commit is contained in:
Daniel
2020-04-06 09:12:59 +02:00
parent caca6995a1
commit ef520571d5
11 changed files with 289 additions and 274 deletions

View File

@@ -0,0 +1,15 @@
describe('Custom Handlers', () => {
const { GET, POST, expect } = require('./capire').launch('bookshop')
it('should reject out-of-stock orders', async () => {
await expect(
Promise.all([
POST('/browse/submitOrder', { book: 201, amount: 5 }),
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`
expect(data).to.equal(2)
})
})