fix: Typ-Generic in checkSuppression, SMTP_PASS Fallback, Logging-Test prüft console.error, tenantId-Fehler-Test
This commit is contained in:
@@ -42,4 +42,10 @@ describe('checkSuppression', () => {
|
||||
expect(call[0]).toContain('$1')
|
||||
expect(call[1]).toEqual(['x@x.com'])
|
||||
})
|
||||
|
||||
it('propagiert Fehler bei ungültiger tenantId nach oben', async () => {
|
||||
const { withTenant } = await import('../db/tenant')
|
||||
vi.mocked(withTenant).mockRejectedValueOnce(new Error('Ungültige tenantId'))
|
||||
await expect(checkSuppression('invalid!', 'x@x.com')).rejects.toThrow('Ungültige tenantId')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -3,7 +3,10 @@ import { withTenant } from '../db/tenant'
|
||||
export async function checkSuppression(tenantId: string, email: string): Promise<boolean> {
|
||||
const normalized = email.toLowerCase().trim()
|
||||
const rows = await withTenant(tenantId, (client) =>
|
||||
client.query('SELECT 1 FROM suppression_list WHERE email = $1 LIMIT 1', [normalized])
|
||||
client.query<{ '?column?': number }>(
|
||||
'SELECT 1 FROM suppression_list WHERE email = $1 LIMIT 1',
|
||||
[normalized]
|
||||
)
|
||||
)
|
||||
return rows.length > 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user