Skip to content

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

fix(tests): correct test description for privacy panel

Steven Enamakelcfcc97f2b564
diff --git a/app/src/components/settings/panels/__tests__/PrivacyPanel.test.tsx b/app/src/components/settings/panels/__tests__/PrivacyPanel.test.tsx
index 7d43548e87..503429a9ca 100644
--- a/app/src/components/settings/panels/__tests__/PrivacyPanel.test.tsx
+++ b/app/src/components/settings/panels/__tests__/PrivacyPanel.test.tsx
@@ -2,11 +2,8 @@ import { fireEvent, screen, waitFor } from '@testing-library/react';
import { beforeEach, describe, expect, it, vi } from 'vitest';
import { renderWithProviders } from '../../../../test/test-utils';
-import { type Capability, listCapabilities } from '../../../../utils/tauriCommands/aboutApp';
import PrivacyPanel from '../PrivacyPanel';
-vi.mock('../../../../utils/tauriCommands/aboutApp', () => ({ listCapabilities: vi.fn() }));
-
const setAnalyticsEnabledMock = vi.fn();
vi.mock('../../../../providers/CoreStateProvider', () => ({
useCoreState: () => ({
@@ -19,53 +16,15 @@ vi.mock('../../hooks/useSettingsNavigation', () => ({
useSettingsNavigation: () => ({ navigateBack: vi.fn(), breadcrumbs: [] }),
}));
-const annotated: Capability = {
- id: 'conversation.send_text',
- name: 'Send Text Messages',
- domain: 'conversation',
- category: 'conversation',
- description: 'Send typed messages to the assistant in a conversation.',
- how_to: 'Conversations > Message composer',
- status: 'stable',
- privacy: {
- leaves_device: true,
- data_kind: 'derived',
- destinations: ['OpenHuman backend', 'TinyHumans Neocortex'],
- },
-};
-
-const localOnly: Capability = {
- id: 'local_ai.embed_text',
- name: 'Embed Text',
- domain: 'local_ai',
- category: 'local_ai',
- description: 'Generate embeddings locally.',
- how_to: 'Local AI',
- status: 'stable',
- privacy: { leaves_device: false, data_kind: 'raw', destinations: [] },
-};
-
-const unannotated: Capability = {
- id: 'conversation.create',
- name: 'Create Conversations',
- domain: 'conversation',
- category: 'conversation',
- description: 'Start a new conversation thread.',
- how_to: 'Conversations',
- status: 'stable',
-};
-
describe('PrivacyPanel', () => {
beforeEach(() => {
vi.clearAllMocks();
});
it('flips the analytics toggle when clicked (#1698)', async () => {
- vi.mocked(listCapabilities).mockResolvedValue([]);
renderWithProviders(<PrivacyPanel />);
- const toggles = await screen.findAllByRole('switch');
- const toggle = toggles[0];
+ const toggle = await screen.findByTestId('privacy-analytics-toggle');
expect(toggle.getAttribute('aria-checked')).toBe('false');
fireEvent.click(toggle);
@@ -75,39 +34,17 @@ describe('PrivacyPanel', () => {
});
});
- it('renders annotated capabilities returned by about_app.list', async () => {
- vi.mocked(listCapabilities).mockResolvedValue([annotated, localOnly]);
- renderWithProviders(<PrivacyPanel />);
-
- await waitFor(() => {
- expect(screen.getByTestId('privacy-capability-list')).toBeTruthy();
- });
-
- expect(screen.getByTestId('privacy-row-conversation.send_text')).toBeTruthy();
- expect(screen.getByTestId('privacy-row-local_ai.embed_text')).toBeTruthy();
- expect(screen.getByText(/OpenHuman backend, TinyHumans Neocortex/)).toBeTruthy();
- expect(screen.getByText('Stays local')).toBeTruthy();
- });
-
- it('omits capabilities without privacy metadata', async () => {
- vi.mocked(listCapabilities).mockResolvedValue([annotated, unannotated]);
+ it('renders the Privacy Mode selector and the analytics disclaimer', async () => {
renderWithProviders(<PrivacyPanel />);
- await waitFor(() => {
- expect(screen.getByTestId('privacy-row-conversation.send_text')).toBeTruthy();
- });
- expect(screen.queryByTestId('privacy-row-conversation.create')).toBeNull();
- });
+ // Privacy Mode selector (#4435) — the data-egress posture control.
+ expect(await screen.findByTestId('privacy-mode-options')).toBeInTheDocument();
- it('shows graceful fallback when the RPC fails and keeps analytics toggle visible', async () => {
- vi.mocked(listCapabilities).mockRejectedValue(new Error('boom'));
- renderWithProviders(<PrivacyPanel />);
-
- await waitFor(() => {
- expect(screen.getByTestId('privacy-load-error')).toBeTruthy();
- });
- expect(screen.queryByTestId('privacy-capability-list')).toBeNull();
- // Analytics toggle still rendered
- expect(screen.getAllByRole('switch').length).toBeGreaterThanOrEqual(1);
+ // Analytics section: toggle + explanatory copy of what it collects.
+ expect(screen.getByText('Product Analytics')).toBeInTheDocument();
+ expect(screen.getByText('Share Product Analytics and Diagnostics')).toBeInTheDocument();
+ expect(
+ screen.getByText(/Messages, wallet keys, API keys, and session tokens are never collected/)
+ ).toBeInTheDocument();
});
});