feat: add "Download all" button to bundle attachments into a zip #466
This commit is contained in:
@@ -6,6 +6,7 @@ import type { Email } from '@/lib/jmap/types';
|
||||
import {
|
||||
emailExportFilename,
|
||||
attachmentDownloadFilename,
|
||||
attachmentsBundleFilename,
|
||||
bundleExportFilename,
|
||||
emailVars,
|
||||
attachmentVars,
|
||||
@@ -93,6 +94,24 @@ describe('bundleExportFilename', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('attachmentsBundleFilename', () => {
|
||||
it('embeds the sanitised subject', () => {
|
||||
expect(attachmentsBundleFilename(makeEmail({ subject: 'Invoice March' }))).toBe('attachments_Invoice March.zip');
|
||||
});
|
||||
|
||||
it('sanitises filesystem-reserved characters', () => {
|
||||
expect(attachmentsBundleFilename(makeEmail({ subject: 'Q1/Q2: report' }))).toBe('attachments_Q1_Q2_ report.zip');
|
||||
});
|
||||
|
||||
it('falls back when the subject is empty', () => {
|
||||
expect(attachmentsBundleFilename(makeEmail({ subject: '' }))).toBe('attachments.zip');
|
||||
});
|
||||
|
||||
it('falls back when there is no email', () => {
|
||||
expect(attachmentsBundleFilename(null)).toBe('attachments.zip');
|
||||
});
|
||||
});
|
||||
|
||||
describe('emailVars (date + address labels)', () => {
|
||||
it('returns the invalid-date sentinel for an unparseable date', () => {
|
||||
const v = emailVars(makeEmail({ receivedAt: 'not-a-date', sentAt: undefined }));
|
||||
|
||||
Reference in New Issue
Block a user