mirror of
https://github.com/bulwarkmail/native.git
synced 2026-11-06 00:07:28 +00:00
30 lines
1.0 KiB
TypeScript
30 lines
1.0 KiB
TypeScript
import { describe, it, expect } from 'vitest';
|
|
import type { Email } from '../../api/types';
|
|
import { replyComposeParams } from '../reply-compose';
|
|
|
|
const source = {
|
|
id: 'm1',
|
|
threadId: 't1',
|
|
mailboxIds: {},
|
|
keywords: {},
|
|
size: 1,
|
|
receivedAt: '2026-10-14T10:00:00Z',
|
|
subject: 'Hello',
|
|
from: [{ name: 'Petra', email: 'petra@example.net' }],
|
|
textBody: [{ partId: '1', type: 'text/plain' }],
|
|
bodyValues: { 1: { value: 'Please confirm.' } },
|
|
} as unknown as Email;
|
|
|
|
describe('replyComposeParams', () => {
|
|
it('carries the text typed in quick reply into the composer', () => {
|
|
const params = replyComposeParams('reply', source, undefined, 'Got it, thanks!');
|
|
expect(params?.prefillBody).toBe('Got it, thanks!');
|
|
expect(params?.replyTo?.from.email).toBe('petra@example.net');
|
|
});
|
|
|
|
it('adds nothing when nothing was typed', () => {
|
|
expect(replyComposeParams('reply', source)?.prefillBody).toBeUndefined();
|
|
expect(replyComposeParams('reply', source, undefined, ' ')?.prefillBody).toBeUndefined();
|
|
});
|
|
});
|