Skip to content

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

style(conversations): reformat thread list and update tests

Steven Enamakel3441f39d7f6e
diff --git a/app/src/features/conversations/aui/PinnedTodoCard.test.tsx b/app/src/features/conversations/aui/PinnedTodoCard.test.tsx
index 6decfd3507..2ecbb78643 100644
--- a/app/src/features/conversations/aui/PinnedTodoCard.test.tsx
+++ b/app/src/features/conversations/aui/PinnedTodoCard.test.tsx
@@ -39,15 +39,22 @@ describe('PinnedTodoCard', () => {
});
it('keeps pending and failed steps from appearing to run when progress is not sequential', () => {
- const { container } = render(<PinnedTodoCard threadId="t1" items={[
- { id: 'pending', text: 'Waiting step', status: 'pending' },
- { id: 'done', text: 'Finished step', status: 'done' },
- { id: 'failed', text: 'Failed step', status: 'failed', reason: 'Retry needed' },
- ]} />);
+ const { container } = render(
+ <PinnedTodoCard
+ threadId="t1"
+ items={[
+ { id: 'pending', text: 'Waiting step', status: 'pending' },
+ { id: 'done', text: 'Finished step', status: 'done' },
+ { id: 'failed', text: 'Failed step', status: 'failed', reason: 'Retry needed' },
+ ]}
+ />
+ );
fireEvent.click(toggle());
expect(screen.getByText('Failed step — Retry needed')).toBeVisible();
expect(container.querySelector('.animate-spin')).toBeNull();
- expect(screen.getAllByTestId('todo-item').map(item => item.getAttribute('data-status'))).toEqual(['pending', 'done', 'failed']);
+ expect(
+ screen.getAllByTestId('todo-item').map(item => item.getAttribute('data-status'))
+ ).toEqual(['pending', 'done', 'failed']);
});
it('opens while a step is active and stays collapsed otherwise', async () => {
diff --git a/app/src/features/conversations/threadList/ThreadList.tsx b/app/src/features/conversations/threadList/ThreadList.tsx
index 81250d1d25..7378f4bb4a 100644
--- a/app/src/features/conversations/threadList/ThreadList.tsx
+++ b/app/src/features/conversations/threadList/ThreadList.tsx
@@ -142,52 +142,52 @@ function ThreadListView() {
const threadIds = useAuiState(s => s.threads.threadIds);
const filtered = threadIds.flatMap(id => {
const thread = props.threads.find(item => item.id === id);
- return thread && props.resolveTitle(id).toLowerCase().includes(search.trim().toLowerCase()) ? [thread] : [];
+ return thread && props.resolveTitle(id).toLowerCase().includes(search.trim().toLowerCase())
+ ? [thread]
+ : [];
});
const groups = groupThreads(filtered, new Date(), props.isPinned ?? isThreadPinned);
return (
- <ThreadListRoot className="h-full min-h-0">
- <div className="flex-none px-2 pb-2">
- <ThreadListNew
- data-testid="new-thread-button"
- data-analytics-id="chat-sidebar-new-thread"
- className="w-full"
- title={t('chat.newThreadShortcut')}>
- {t('chat.newConversation')}
- </ThreadListNew>
- {props.threads.length > 0 && (
- <ThreadListSearch value={search} onValueChange={setSearch} />
- )}
- </div>
- <div
- data-slot="aui_thread-list-items"
- className="flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto px-2 pb-3 [scrollbar-gutter:stable_both-edges] [scrollbar-width:thin]">
- {groups.map(group => (
- <section
- key={group.key}
- data-testid={`thread-group-${group.key}`}
- aria-label={t(GROUP_LABEL_KEYS[group.key])}
- className="flex flex-col gap-0.5">
- <h3
- data-slot="aui_thread-list-group-label"
- className="text-muted-foreground px-2.5 pt-3 pb-1 text-xs font-medium">
- {t(GROUP_LABEL_KEYS[group.key])}
- </h3>
- {group.threads.map(thread => (
- <ThreadListPrimitive.ItemByIndex
- key={thread.id}
- index={threadIds.indexOf(thread.id)}
- components={{ ThreadListItem: ThreadRow }}
- />
- ))}
- </section>
+ <ThreadListRoot className="h-full min-h-0">
+ <div className="flex-none px-2 pb-2">
+ <ThreadListNew
+ data-testid="new-thread-button"
+ data-analytics-id="chat-sidebar-new-thread"
+ className="w-full"
+ title={t('chat.newThreadShortcut')}>
+ {t('chat.newConversation')}
+ </ThreadListNew>
+ {props.threads.length > 0 && <ThreadListSearch value={search} onValueChange={setSearch} />}
+ </div>
+ <div
+ data-slot="aui_thread-list-items"
+ className="flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto px-2 pb-3 [scrollbar-gutter:stable_both-edges] [scrollbar-width:thin]">
+ {groups.map(group => (
+ <section
+ key={group.key}
+ data-testid={`thread-group-${group.key}`}
+ aria-label={t(GROUP_LABEL_KEYS[group.key])}
+ className="flex flex-col gap-0.5">
+ <h3
+ data-slot="aui_thread-list-group-label"
+ className="text-muted-foreground px-2.5 pt-3 pb-1 text-xs font-medium">
+ {t(GROUP_LABEL_KEYS[group.key])}
+ </h3>
+ {group.threads.map(thread => (
+ <ThreadListPrimitive.ItemByIndex
+ key={thread.id}
+ index={threadIds.indexOf(thread.id)}
+ components={{ ThreadListItem: ThreadRow }}
+ />
))}
- {groups.length === 0 && (
- <p className="text-muted-foreground px-2.5 py-4 text-center text-xs">
- {t(search ? 'assistantUi.threadList.noThreadsFound' : 'chat.noThreads')}
- </p>
- )}
- </div>
- </ThreadListRoot>
+ </section>
+ ))}
+ {groups.length === 0 && (
+ <p className="text-muted-foreground px-2.5 py-4 text-center text-xs">
+ {t(search ? 'assistantUi.threadList.noThreadsFound' : 'chat.noThreads')}
+ </p>
+ )}
+ </div>
+ </ThreadListRoot>
);
}
diff --git a/app/src/pages/__tests__/Conversations.render.test.tsx b/app/src/pages/__tests__/Conversations.render.test.tsx
index 7d334dcf15..b47cd894b9 100644
--- a/app/src/pages/__tests__/Conversations.render.test.tsx
+++ b/app/src/pages/__tests__/Conversations.render.test.tsx
@@ -9,6 +9,7 @@
*/
import { combineReducers, configureStore } from '@reduxjs/toolkit';
import { act, cleanup, fireEvent, render, screen, waitFor, within } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
import { Provider } from 'react-redux';
import { MemoryRouter, Route, Routes, useLocation } from 'react-router-dom';
import { beforeEach, describe, expect, it, vi } from 'vitest';
@@ -482,9 +483,8 @@ describe('Conversations — smoke render (#1123 welcome-lock removal)', () => {
});
const betaRow = await screen.findByRole('button', { name: /Thread Beta/ });
- await act(async () => {
- fireEvent.keyDown(betaRow, { key: 'Enter' });
- });
+ betaRow.focus();
+ await userEvent.keyboard('{Enter}');
await waitFor(() => {
expect(screen.getByTestId('route-path')).toHaveTextContent('/chat/t-2');
});
@@ -777,11 +777,8 @@ describe('Conversations — smoke render (#1123 welcome-lock removal)', () => {
expect(screen.getAllByText('Deletable Thread').length).toBeGreaterThan(0);
});
- // The delete button has title="Delete thread"
- const deleteBtn = screen.getByTitle('Delete thread');
- await act(async () => {
- fireEvent.click(deleteBtn);
- });
+ await userEvent.click(screen.getByRole('button', { name: 'More options' }));
+ await userEvent.click(await screen.findByRole('menuitem', { name: 'Delete' }));
// The modal should now be open — "Are you sure you want to delete" text
// This verifies lines 981, 982, 985 inside the delete onClick callback executed
@@ -797,10 +794,8 @@ describe('Conversations — smoke render (#1123 welcome-lock removal)', () => {
});
await openSidebar();
- const deleteBtn = await screen.findByTitle('Delete thread');
- await act(async () => {
- fireEvent.click(deleteBtn);
- });
+ await userEvent.click(await screen.findByRole('button', { name: 'More options' }));
+ await userEvent.click(await screen.findByRole('menuitem', { name: 'Delete' }));
await act(async () => {
fireEvent.click(screen.getByRole('button', { name: 'Delete' }));
});