Change File Added format

This commit is contained in:
Alex Gleason committed 2025-09-14 14:29:14 -05:00
1 parent 425976bb82
commit feaa767632
5 files changed
+34 -34

No files matched your search

+16 -16
View File
@@ -7,42 +7,42 @@ describe('UserMessage Integration', () => {
// Simulate the new text parts structure that ChatPane would create
const content = [
{ type: 'text' as const, text: 'Please analyze this file:' },
{ type: 'text' as const, text: 'File added to /tmp/data.csv' },
{ type: 'text' as const, text: 'Added file: /tmp/data.csv' },
{ type: 'text' as const, text: 'Let me know what you find!' }
];
render(<UserMessage content={content} />);
// Check that regular text is displayed
expect(screen.getByText('Please analyze this file:')).toBeInTheDocument();
expect(screen.getByText('Let me know what you find!')).toBeInTheDocument();
// Check that file attachment is rendered as a badge
expect(screen.getByText('data.csv')).toBeInTheDocument();
expect(screen.getByText('added to /tmp/data.csv')).toBeInTheDocument();
expect(screen.getByText('/tmp/data.csv')).toBeInTheDocument();
});
it('handles single text part with file attachment', () => {
const content = [
{ type: 'text' as const, text: 'File added to /tmp/script.js' }
{ type: 'text' as const, text: 'Added file: /tmp/script.js' }
];
render(<UserMessage content={content} />);
expect(screen.getByText('script.js')).toBeInTheDocument();
expect(screen.getByText('added to /tmp/script.js')).toBeInTheDocument();
expect(screen.getByText('/tmp/script.js')).toBeInTheDocument();
});
it('handles multiple file attachments in separate parts', () => {
const content = [
{ type: 'text' as const, text: 'Here are my files:' },
{ type: 'text' as const, text: 'File added to /tmp/config.json' },
{ type: 'text' as const, text: 'File added to /tmp/styles.css' },
{ type: 'text' as const, text: 'File added to /tmp/main.js' }
{ type: 'text' as const, text: 'Added file: /tmp/config.json' },
{ type: 'text' as const, text: 'Added file: /tmp/styles.css' },
{ type: 'text' as const, text: 'Added file: /tmp/main.js' }
];
render(<UserMessage content={content} />);
expect(screen.getByText('Here are my files:')).toBeInTheDocument();
expect(screen.getByText('config.json')).toBeInTheDocument();
expect(screen.getByText('styles.css')).toBeInTheDocument();
@@ -51,9 +51,9 @@ describe('UserMessage Integration', () => {
it('handles empty content gracefully', () => {
const content: Array<{ type: 'text'; text: string }> = [];
const { container } = render(<UserMessage content={content} />);
expect(container.firstChild).toBeNull();
});
});