Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/composables/auth/useCurrentUser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,26 @@ describe('useCurrentUser', () => {
expect(resolvedUserInfo.value).toEqual({ id: 'host-user' })
})

it('shows a Desktop host account by its email, without repeating it as the name', async () => {
const signedIn = {
status: 'signed_in',
userId: 'host-user',
email: 'sso@example.com'
} as const
await startDesktopHostSession({
getState: async () => signedIn,
getWorkspaceToken: async () => 'host-token',
requestSignIn: async () => signedIn,
signOut: async () => ({ status: 'signed_out' }),
onChanged: () => () => {}
})

const { userDisplayName, userEmail } = useCurrentUser()

expect(userEmail.value).toBe('sso@example.com')
expect(userDisplayName.value).toBeUndefined()
})

it('reads a Firebase-only login entirely from Firebase', () => {
mockAuthState.currentUser = fromPartial<
NonNullable<typeof mockAuthState.currentUser>
Expand Down
2 changes: 1 addition & 1 deletion src/composables/auth/useCurrentUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export const useCurrentUser = () => {
}

const userDisplayName = computed(() => {
if (desktopHostUser.value) return desktopHostUser.value.email
if (desktopHostUser.value) return undefined
if (isApiKeyLogin.value) {
return apiKeyStore.currentUser?.name
}
Expand Down
Loading