🐛 fix typecheck and cleanup imports
tinyedge/deploy Deployed by TinyEdge

This commit is contained in:
2026-08-07 12:57:45 +02:00
parent c6b78d4665
commit 67727f96ab
17 changed files with 1790 additions and 1352 deletions
+22
View File
@@ -173,4 +173,26 @@ describe('Pot API', async () => {
$fetch(`/api/pots/${pot.slug}/participants/${alice.id}`, { method: 'PATCH', body: { paymentLink: 'javascript:alert(1)' } }),
).rejects.toMatchObject({ statusCode: 400 })
})
it('removes a participant without expenses but blocks removing one with expenses', async () => {
const pot = await $fetch('/api/pots', { method: 'POST', body: { name: 'Ski Trip', currency: 'EUR', creatorName: 'Alice' } })
const alice = pot.creator
const bob = await $fetch(`/api/pots/${pot.slug}/participants`, { method: 'POST', body: { name: 'Bob' } })
await $fetch(`/api/pots/${pot.slug}/expenses`, {
method: 'POST',
body: { description: 'Lift pass', amountCents: 1000, payerId: alice.id, participantIds: [alice.id, bob.id] },
})
await expect(
$fetch(`/api/pots/${pot.slug}/participants/${bob.id}`, { method: 'DELETE' }),
).rejects.toMatchObject({ statusCode: 409 })
const carol = await $fetch(`/api/pots/${pot.slug}/participants`, { method: 'POST', body: { name: 'Carol' } })
const result = await $fetch(`/api/pots/${pot.slug}/participants/${carol.id}`, { method: 'DELETE' })
expect(result.success).toBe(true)
const fetched = await $fetch(`/api/pots/${pot.slug}`)
expect(fetched.participants.map(p => p.id)).not.toContain(carol.id)
})
})