import { afterEach, describe, expect, it, vi } from 'vitest'; import { prepareQuickReply } from '@/lib/outgoing/quick-reply'; import { registerOutgoingFinalizer, registerPreSendCheck, resetSendPipeline } from '@/lib/outgoing/send-pipeline'; import type { Identity } from '@/lib/jmap/types'; vi.mock('@/lib/debug', () => ({ debug: { log: () => {}, warn: () => {}, error: () => {} } })); // Quick reply goes through the same checks and finalisers as the composer, // so the disclaimer and the external-recipient confirm reach it too. const html = { id: 'i', name: 'Me', email: 'me@example.com', htmlSignature: 'Me', textSignature: '' } as Identity; const text = { id: 'i', name: 'Me', email: 'me@example.com', htmlSignature: '', textSignature: 'Me' } as Identity; const input = (signatureIdentity: Identity) => ({ body: 'Thanks <3', signatureIdentity, separator: true, to: ['bob@example.com'], fromEmail: 'me@example.com', identityId: 'i', }); afterEach(() => resetSendPipeline()); describe('prepareQuickReply', () => { it('builds the text and, for an HTML signature, an escaped HTML body', async () => { const withHtml = await prepareQuickReply(input(html)); expect(withHtml?.html).toContain('