Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(queue): cover queue slice reducers

Steven Enamakelc0e4d746c091
diff --git a/app/src/store/queueSlice.test.ts b/app/src/store/queueSlice.test.ts
index 0e4ea61735..ada62a3395 100644
--- a/app/src/store/queueSlice.test.ts
+++ b/app/src/store/queueSlice.test.ts
@@ -216,3 +216,19 @@ describe('clipQueuePreview', () => {
expect(clipQueuePreview('😀'.repeat(81))).toBe(`${'😀'.repeat(80)}…`);
});
});
+
+describe('clipQueuePreview with typed attachments', () => {
+ const file = (name?: string) => ({
+ kind: 'file' as const,
+ media: { url: 'data:application/pdf;base64,AAA', fileName: name },
+ });
+
+ it('uses the caption when there is one', () => {
+ expect(clipQueuePreview('see this', [file('a.pdf')])).toBe('see this');
+ });
+
+ it('falls back to the attachment file names when there is no caption', () => {
+ expect(clipQueuePreview('', [file('a.pdf'), file('b.pdf')])).toBe('a.pdf, b.pdf');
+ expect(clipQueuePreview('', [file()])).toBe('attachment');
+ });
+});