Skip to content

Commit e1a4dc4

Browse files
committed
fix(auth): display email address instead of name in connected status
Changes "Connected as [name]" to "Connected as [email]" as requested.
1 parent 97536f1 commit e1a4dc4

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/components/Auth/ApiKeyStatus.test.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ describe('ApiKeyStatus', () => {
6868
isValid: true,
6969
isValidating: false,
7070
clearApiKey: mockClearApiKey,
71-
username: 'Test User',
71+
username: 'testuser@mozilla.com',
7272
}
7373
// @ts-expect-error - Simplified mock for testing
7474
return selector(state)
@@ -81,10 +81,10 @@ describe('ApiKeyStatus', () => {
8181
expect(screen.getByText(/connected/i)).toBeInTheDocument()
8282
})
8383

84-
it('should show username in connected message', () => {
84+
it('should show email address in connected message', () => {
8585
render(<ApiKeyStatus onOpenModal={mockOnOpenModal} />)
8686

87-
expect(screen.getByText(/test user/i)).toBeInTheDocument()
87+
expect(screen.getByText(/testuser@mozilla\.com/i)).toBeInTheDocument()
8888
})
8989

9090
it('should show playful authenticated message', () => {

src/store/slices/auth-slice.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,12 @@ describe('AuthSlice', () => {
103103
expect(isValid).toBe(true)
104104
})
105105

106-
it('should fetch and store username on successful validation', async () => {
106+
it('should fetch and store email on successful validation', async () => {
107107
const { setApiKey } = useStore.getState()
108108
await setApiKey('test-api-key-123')
109109

110110
const { username } = useStore.getState()
111-
expect(username).toBe('Test User')
111+
expect(username).toBe('test@mozilla.com')
112112
expect(mockWhoAmI).toHaveBeenCalled()
113113
})
114114

@@ -204,7 +204,7 @@ describe('AuthSlice', () => {
204204
await setApiKey('test-api-key-123')
205205

206206
const { username: usernameBefore } = useStore.getState()
207-
expect(usernameBefore).toBe('Test User')
207+
expect(usernameBefore).toBe('test@mozilla.com')
208208

209209
clearApiKey()
210210

src/store/slices/auth-slice.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export const createAuthSlice: StateCreator<AuthSlice> = (set, get) => ({
6060
isValid: true,
6161
isValidating: false,
6262
validationError: null,
63-
username: userInfo.real_name || userInfo.name,
63+
username: userInfo.name,
6464
})
6565
} catch (error) {
6666
const errorMessage = error instanceof Error ? error.message : 'Unknown error'
@@ -104,7 +104,7 @@ export const createAuthSlice: StateCreator<AuthSlice> = (set, get) => ({
104104
isValid: true,
105105
isValidating: false,
106106
validationError: null,
107-
username: userInfo.real_name || userInfo.name,
107+
username: userInfo.name,
108108
})
109109
} catch (error) {
110110
const errorMessage = error instanceof Error ? error.message : 'Unknown error'

0 commit comments

Comments
 (0)