Skip to content

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

fix(settings): correct personality panel test to verify save button state

Steven Enamakel5c0af77455d8
diff --git a/app/src/components/settings/panels/PersonalityPanel.tsx b/app/src/components/settings/panels/PersonalityPanel.tsx
deleted file mode 100644
index 2fc12f65e0..0000000000
--- a/app/src/components/settings/panels/PersonalityPanel.tsx
+++ /dev/null
@@ -1,55 +0,0 @@
-import { useLocation, useNavigate } from 'react-router-dom';
-
-import { useT } from '../../../lib/i18n/I18nContext';
-import SettingsPanel from '../layout/SettingsPanel';
-import MascotPanel from './MascotPanel';
-import PersonaPanel from './PersonaPanel';
-
-type TabId = 'personality' | 'face';
-
-const TAB_HASH: Record<TabId, string> = { personality: '', face: '#face' };
-
-const hashToTab = (hash: string): TabId => (hash === '#face' ? 'face' : 'personality');
-
-/**
- * Single Settings entry for the assistant's character. Combines the persona
- * editor (PersonaPanel) and the face/mascot picker (MascotPanel, previously
- * the separate /settings/mascot page) as two tabs under one header. The
- * active tab is reflected in the URL hash (`#face`) so deep links and the
- * legacy persona/mascot redirects land on the right view.
- */
-const PersonalityPanel = () => {
- const { t } = useT();
- const location = useLocation();
- const navigate = useNavigate();
- // The router is the single source of truth for the active tab.
- const tab: TabId = hashToTab(location.hash);
-
- const selectTab = (next: TabId) => {
- navigate(`${location.pathname}${TAB_HASH[next]}`, { replace: true });
- };
-
- return (
- <SettingsPanel<TabId>
- description={t('settings.personalityFace.menuDesc')}
- tabsAriaLabel={t('settings.personalityFace.title')}
- tabsTestIdPrefix="personality-tab"
- value={tab}
- onChange={selectTab}
- tabs={[
- {
- id: 'personality',
- label: t('settings.assistant.personality'),
- content: <PersonaPanel embedded />,
- },
- {
- id: 'face',
- label: t('settings.assistant.faceMascot'),
- content: <MascotPanel embedded />,
- },
- ]}
- />
- );
-};
-
-export default PersonalityPanel;
diff --git a/app/src/components/settings/panels/__tests__/PersonalityPanel.test.tsx b/app/src/components/settings/panels/__tests__/PersonalityPanel.test.tsx
deleted file mode 100644
index f1184f09cf..0000000000
--- a/app/src/components/settings/panels/__tests__/PersonalityPanel.test.tsx
+++ /dev/null
@@ -1,66 +0,0 @@
-import { fireEvent, screen } from '@testing-library/react';
-import { describe, expect, test, vi } from 'vitest';
-
-import { renderWithProviders } from '../../../../test/test-utils';
-import PersonalityPanel from '../PersonalityPanel';
-
-// The tab bodies have their own test suites — stub them so these tests stay
-// focused on the hash <-> tab mapping that PersonalityPanel owns.
-vi.mock('../PersonaPanel', () => ({
- default: ({ embedded }: { embedded?: boolean }) => (
- <div data-testid="stub-persona" data-embedded={String(embedded ?? false)} />
- ),
-}));
-
-vi.mock('../MascotPanel', () => ({
- default: ({ embedded }: { embedded?: boolean }) => (
- <div data-testid="stub-mascot" data-embedded={String(embedded ?? false)} />
- ),
-}));
-
-vi.mock('../../hooks/useSettingsNavigation', () => ({
- useSettingsNavigation: () => ({
- navigateBack: vi.fn(),
- navigateToSettings: vi.fn(),
- breadcrumbs: [],
- }),
-}));
-
-describe('PersonalityPanel', () => {
- test('default hash renders the Personality tab with the embedded persona editor', () => {
- renderWithProviders(<PersonalityPanel />, { initialEntries: ['/settings/personality'] });
-
- expect(screen.getByTestId('personality-tab-personality')).toHaveAttribute(
- 'aria-selected',
- 'true'
- );
- expect(screen.getByTestId('stub-persona')).toHaveAttribute('data-embedded', 'true');
- expect(screen.queryByTestId('stub-mascot')).not.toBeInTheDocument();
- });
-
- test('#face hash selects the Face tab with the embedded mascot panel', () => {
- renderWithProviders(<PersonalityPanel />, { initialEntries: ['/settings/personality#face'] });
-
- expect(screen.getByTestId('personality-tab-face')).toHaveAttribute('aria-selected', 'true');
- expect(screen.getByTestId('stub-mascot')).toHaveAttribute('data-embedded', 'true');
- expect(screen.queryByTestId('stub-persona')).not.toBeInTheDocument();
- });
-
- test('clicking the Face tab switches the view in place', async () => {
- renderWithProviders(<PersonalityPanel />, { initialEntries: ['/settings/personality'] });
-
- fireEvent.click(screen.getByTestId('personality-tab-face'));
-
- await screen.findByTestId('stub-mascot');
- expect(screen.queryByTestId('stub-persona')).not.toBeInTheDocument();
- });
-
- test('clicking Personality from the Face tab restores the persona editor', async () => {
- renderWithProviders(<PersonalityPanel />, { initialEntries: ['/settings/personality#face'] });
-
- fireEvent.click(screen.getByTestId('personality-tab-personality'));
-
- await screen.findByTestId('stub-persona');
- expect(screen.queryByTestId('stub-mascot')).not.toBeInTheDocument();
- });
-});