mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 16:23:36 +00:00
Remove path from added file render
This commit is contained in:
3 files changed
+10
-6
No files matched your search
@@ -19,7 +19,8 @@ describe('UserMessage Integration', () => {
|
||||
|
||||
// Check that file attachment is rendered as a badge
|
||||
expect(screen.getByText('data.csv')).toBeInTheDocument();
|
||||
expect(screen.getByText('/tmp/data.csv')).toBeInTheDocument();
|
||||
// Full path should not be displayed
|
||||
expect(screen.queryByText('/tmp/data.csv')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('handles single text part with file attachment', () => {
|
||||
@@ -30,7 +31,8 @@ describe('UserMessage Integration', () => {
|
||||
render(<UserMessage content={content} />);
|
||||
|
||||
expect(screen.getByText('script.js')).toBeInTheDocument();
|
||||
expect(screen.getByText('/tmp/script.js')).toBeInTheDocument();
|
||||
// Full path should not be displayed
|
||||
expect(screen.queryByText('/tmp/script.js')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('handles multiple file attachments in separate parts', () => {
|
||||
|
||||
@@ -30,7 +30,8 @@ describe('UserMessage', () => {
|
||||
|
||||
expect(screen.getByText('Here is my file:')).toBeInTheDocument();
|
||||
expect(screen.getByText('test.txt')).toBeInTheDocument();
|
||||
expect(screen.getByText('/tmp/test.txt')).toBeInTheDocument();
|
||||
// Full path should not be displayed
|
||||
expect(screen.queryByText('/tmp/test.txt')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('renders multiple file attachments with text parts', () => {
|
||||
@@ -64,7 +65,8 @@ describe('UserMessage', () => {
|
||||
render(<UserMessage content={content} />);
|
||||
|
||||
expect(screen.getByText('README')).toBeInTheDocument();
|
||||
expect(screen.getByText('/tmp/README')).toBeInTheDocument();
|
||||
// Full path should not be displayed
|
||||
expect(screen.queryByText('/tmp/README')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('handles complex filenames with underscores and numbers', () => {
|
||||
@@ -73,7 +75,8 @@ describe('UserMessage', () => {
|
||||
render(<UserMessage content={content} />);
|
||||
|
||||
expect(screen.getByText('my_file_1.txt')).toBeInTheDocument();
|
||||
expect(screen.getByText('/tmp/my_file_1.txt')).toBeInTheDocument();
|
||||
// Full path should not be displayed
|
||||
expect(screen.queryByText('/tmp/my_file_1.txt')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('preserves whitespace in text content', () => {
|
||||
|
||||
@@ -75,7 +75,6 @@ export function UserMessage({ content }: UserMessageProps) {
|
||||
<Badge variant="secondary" className="flex items-center gap-1.5 px-2 py-1">
|
||||
{getFileIcon(filename)}
|
||||
<span className="text-xs font-medium">{filename}</span>
|
||||
<span className="text-xs text-muted-foreground">{part.filepath}</span>
|
||||
</Badge>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user