feat: play button, last played, loan lend/return on item page
This commit is contained in:
@@ -56,6 +56,22 @@ describe('loans', () => {
|
||||
await app.close()
|
||||
})
|
||||
|
||||
it('detail route reports the active loan, null before lending', async () => {
|
||||
const { app, cookie, itemId } = await appWithItem()
|
||||
const before = await app.inject({ method: 'GET', url: `/api/collection/${itemId}`, ...auth(cookie) })
|
||||
expect(before.json().loan).toBeNull()
|
||||
|
||||
await app.inject({
|
||||
method: 'POST',
|
||||
url: `/api/collection/${itemId}/loan`,
|
||||
...auth(cookie),
|
||||
payload: { borrower: 'Bob' },
|
||||
})
|
||||
const after = await app.inject({ method: 'GET', url: `/api/collection/${itemId}`, ...auth(cookie) })
|
||||
expect(after.json().loan).toMatchObject({ borrower: 'Bob' })
|
||||
await app.close()
|
||||
})
|
||||
|
||||
it('validates borrower and ownership', async () => {
|
||||
const { app, cookie, itemId } = await appWithItem()
|
||||
const empty = await app.inject({
|
||||
|
||||
Reference in New Issue
Block a user