Files
webmail/lib/compose/__tests__/attachment-order.test.ts
T
Linus Rath 2b2b7b8298 fix: show every attachment in the composer, with type icons and a total, failed and uploading files first
The attachment list test now expects every chip and a bounded, scrolling row instead of three chips and a +N counter.
2026-11-04 09:01:04 +01:00

19 lines
777 B
TypeScript

import { describe, expect, it } from 'vitest';
import { attachmentsForDisplay } from '../attachment-order';
describe('the order of the composer attachment chips', () => {
it('puts failed, then uploading files first, and keeps the rest in the order added', () => {
const files = [
{ name: 'a.pdf' },
{ name: 'b.pdf', uploading: true },
{ name: 'c.pdf' },
{ name: 'big.zip', uploading: true },
{ name: 'broken.png', error: 'failed' },
];
const shown = attachmentsForDisplay(files);
expect(shown.map(({ att }) => att.name)).toEqual(['broken.png', 'b.pdf', 'big.zip', 'a.pdf', 'c.pdf']);
// Each keeps its place in the composer's list, for Remove.
expect(shown.map(({ index }) => index)).toEqual([4, 1, 3, 0, 2]);
});
});