fix: release() absichern, DATABASE_URL Startup-Check, execute-Test hinzugefügt
This commit is contained in:
@@ -53,13 +53,15 @@ describe('withTenant', () => {
|
||||
).rejects.toThrow('Ungültige tenantId')
|
||||
})
|
||||
|
||||
it('gibt dieselbe Client-Instanz an fn weiter (Connection-Isolation)', async () => {
|
||||
let capturedClient: unknown
|
||||
await withTenant('tenant1', async (client) => {
|
||||
capturedClient = client
|
||||
})
|
||||
// Client muss nach withTenant released worden sein
|
||||
it('released PoolClient nach Ausführung', async () => {
|
||||
await withTenant('tenant1', async () => {})
|
||||
expect(mockClient.release).toHaveBeenCalledOnce()
|
||||
expect(capturedClient).toBeDefined()
|
||||
})
|
||||
|
||||
it('execute delegiert an den dedizierten PoolClient', async () => {
|
||||
await withTenant('abc123', async (client) => {
|
||||
await client.execute('DELETE FROM sessions WHERE expired = true')
|
||||
})
|
||||
expect(mockClient.query).toHaveBeenCalledWith('DELETE FROM sessions WHERE expired = true')
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user