Skip to content

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

chore: remove unused test files for sidebar components

Steven Enamakel94f00e5174da
diff --git a/app/src/components/layout/shell/SidebarHeader.test.tsx b/app/src/components/layout/shell/SidebarHeader.test.tsx
index 1ca89f852d..a9f6f33689 100644
--- a/app/src/components/layout/shell/SidebarHeader.test.tsx
+++ b/app/src/components/layout/shell/SidebarHeader.test.tsx
@@ -19,9 +19,10 @@ vi.mock('../../../lib/i18n/I18nContext', () => ({ useT: () => ({ t: (k: string)
describe('SidebarHeader', () => {
beforeEach(() => vi.clearAllMocks());
- it('renders Keyboard Shortcuts, Settings, and Collapse buttons', () => {
+ it('renders Keyboard Shortcuts, Feedback, Settings, and Collapse buttons', () => {
renderWithProviders(<SidebarHeader />, { initialEntries: ['/home'] });
expect(screen.getByRole('button', { name: 'shortcuts.title' })).toBeInTheDocument();
+ expect(screen.getByRole('button', { name: 'nav.feedback' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: 'nav.settings' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: 'chat.hideSidebar' })).toBeInTheDocument();
// The wallet shortcut was removed long ago; Home followed it, since the
@@ -61,6 +62,22 @@ describe('SidebarHeader', () => {
expect(mockNavigate).toHaveBeenCalledWith('/settings');
});
+ // Feedback moved here from the sidebar footer row: it is a utility action
+ // like the other three, not a destination the user returns to.
+ it('feedback button navigates to /feedback', () => {
+ renderWithProviders(<SidebarHeader />, { initialEntries: ['/home'] });
+ fireEvent.click(screen.getByRole('button', { name: 'nav.feedback' }));
+ expect(mockNavigate).toHaveBeenCalledWith('/feedback');
+ });
+
+ it('marks the feedback button current while the route is open', () => {
+ renderWithProviders(<SidebarHeader />, { initialEntries: ['/feedback'] });
+ expect(screen.getByRole('button', { name: 'nav.feedback' })).toHaveAttribute(
+ 'aria-current',
+ 'page'
+ );
+ });
+
it('Collapse button calls hide()', () => {
renderWithProviders(<SidebarHeader />, { initialEntries: ['/home'] });
fireEvent.click(screen.getByRole('button', { name: 'chat.hideSidebar' }));
diff --git a/app/src/components/layout/shell/SidebarNav.test.tsx b/app/src/components/layout/shell/SidebarNav.test.tsx
index 027cac4d36..29530c8af9 100644
--- a/app/src/components/layout/shell/SidebarNav.test.tsx
+++ b/app/src/components/layout/shell/SidebarNav.test.tsx
@@ -1,5 +1,5 @@
import { fireEvent, screen } from '@testing-library/react';
-import { describe, expect, it, vi } from 'vitest';
+import { beforeEach, describe, expect, it, vi } from 'vitest';
import { renderWithProviders } from '../../../test/test-utils';
import { AGENT_ACCOUNT_ID } from '../../../utils/accountsFullscreen';
@@ -8,6 +8,15 @@ import SidebarNav from './SidebarNav';
// Analytics is fire-and-forget; stub it so the nav renders without a transport.
vi.mock('../../../services/analytics', () => ({ trackEvent: vi.fn() }));
+// Mutable so each test can pick the session kind. `isReady` sits alongside
+// `snapshot` on the core-state value (not inside the snapshot). Must be
+// `mock`-prefixed so the hoisted vi.mock factory below may close over it.
+let mockCoreState: { snapshot: { sessionToken: string | null }; isReady: boolean } = {
+ snapshot: { sessionToken: 'cloud.session.token' },
+ isReady: true,
+};
+vi.mock('../../../providers/CoreStateProvider', () => ({ useCoreState: () => mockCoreState }));
+
/**
* `bg-white` spelled indirectly. `lint:ui-tokens` scans this directory now and
* its raw-palette pattern cannot tell an assertion's literal from a usage.
@@ -95,3 +104,47 @@ describe('SidebarNav active matching', () => {
expect(store.getState().accounts.activeAccountId).toBe(AGENT_ACCOUNT_ID);
});
});
+
+/**
+ * Rewards is the one `cloudOnly` nav entry. These moved here from
+ * `AppSidebar.test.tsx` when Rewards stopped being a sidebar footer row and
+ * became a primary destination: the gate lives in `useCloudNavGate` and is
+ * applied by this component (and `CollapsedNavRail`), so this is where it is
+ * observable.
+ */
+describe('SidebarNav — cloud-gated Rewards entry', () => {
+ beforeEach(() => {
+ mockCoreState = { snapshot: { sessionToken: 'cloud.session.token' }, isReady: true };
+ });
+
+ it('shows Rewards for a resolved cloud session', () => {
+ renderWithProviders(<SidebarNav />, { initialEntries: ['/chat'] });
+
+ expect(tabButton('Rewards')).toBeInTheDocument();
+ });
+
+ it('hides Rewards for a local session', () => {
+ mockCoreState = { snapshot: { sessionToken: 'header.payload.local' }, isReady: true };
+ renderWithProviders(<SidebarNav />, { initialEntries: ['/chat'] });
+
+ expect(screen.queryByRole('button', { name: /Rewards/ })).not.toBeInTheDocument();
+ // The ungated entries are unaffected.
+ expect(tabButton('Chat')).toBeInTheDocument();
+ });
+
+ it('hides Rewards until core state has bootstrapped (no flash)', () => {
+ // Initial snapshot before the first refresh: not ready, null token.
+ // isLocalSessionToken(null) is false, so gating on the token alone would
+ // briefly show Rewards here — the isReady guard prevents that flash.
+ mockCoreState = { snapshot: { sessionToken: null }, isReady: false };
+ renderWithProviders(<SidebarNav />, { initialEntries: ['/chat'] });
+
+ expect(screen.queryByRole('button', { name: /Rewards/ })).not.toBeInTheDocument();
+ });
+
+ it('marks Rewards active on the /rewards route', () => {
+ renderWithProviders(<SidebarNav />, { initialEntries: ['/rewards'] });
+
+ expect(tabButton('Rewards')).toHaveAttribute('aria-current', 'page');
+ });
+});