Skip to content

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

fix(test): update AccountPanel test to match new API response format

Steven Enamakel8a7c8bb2248d
diff --git a/app/src/components/settings/panels/__tests__/AccountPanel.test.tsx b/app/src/components/settings/panels/__tests__/AccountPanel.test.tsx
index 766406ffc1..ea1fc00da0 100644
--- a/app/src/components/settings/panels/__tests__/AccountPanel.test.tsx
+++ b/app/src/components/settings/panels/__tests__/AccountPanel.test.tsx
@@ -28,7 +28,7 @@ vi.mock('../../LogoutAndClearActions', () => ({
}));
describe('AccountPanel', () => {
- it('renders the signed-in summary with name, username and avatar initial', () => {
+ it('renders the signed-in summary with name and signed-in label', () => {
mockUseCoreState.mockReturnValue({
snapshot: { currentUser: { firstName: 'Test', lastName: 'Human', username: 'testhuman' } },
});
@@ -36,21 +36,20 @@ describe('AccountPanel', () => {
renderWithProviders(<AccountPanel />);
expect(screen.getByText('Test Human')).toBeInTheDocument();
- expect(screen.getByText('@testhuman')).toBeInTheDocument();
- // Avatar initial derives from the display name (line ~29).
- expect(screen.getByText('T')).toBeInTheDocument();
+ expect(screen.getByText('Signed in to OpenHuman')).toBeInTheDocument();
expect(screen.getByTestId('logout-and-clear-actions')).toBeInTheDocument();
});
- it('falls back to the username initial when only a username is present', () => {
+ it('renders just the signed-in label when only a username is present (no display name)', () => {
mockUseCoreState.mockReturnValue({ snapshot: { currentUser: { username: 'solohuman' } } });
renderWithProviders(<AccountPanel />);
- expect(screen.getByText('@solohuman')).toBeInTheDocument();
- // No display name, so the initial comes from the username (the leading '@'
- // is stripped before slicing).
- expect(screen.getByText('S')).toBeInTheDocument();
+ // No display name, so no name text renders, but the signed-in label and
+ // profile card still do.
+ expect(screen.getByTestId('account-profile')).toBeInTheDocument();
+ expect(screen.getByText('Signed in to OpenHuman')).toBeInTheDocument();
+ expect(screen.queryByText('Test Human')).not.toBeInTheDocument();
});
it('omits the summary block when there is no current user', () => {