Skip to content

Commit c8b8ad8

Browse files
Remove unused function
1 parent 29b9f2d commit c8b8ad8

File tree

3 files changed

+1
-68
lines changed

3 files changed

+1
-68
lines changed

packages/cli-kit/src/private/node/session/store.test.ts

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {Sessions} from './schema.js'
2-
import {store, fetch, remove, getSessionAlias, updateSessionAlias, findSessionByAlias} from './store.js'
2+
import {store, fetch, remove, getSessionAlias, findSessionByAlias} from './store.js'
33
import {getSessions, removeSessions, setSessions, removeCurrentSessionId} from '../conf-store.js'
44
import {identityFqdn} from '../../../public/node/context/fqdn.js'
55
import {describe, expect, vi, test, beforeEach} from 'vitest'
@@ -131,55 +131,6 @@ describe('session store', () => {
131131
})
132132
})
133133

134-
describe('updateSessionAlias', () => {
135-
test('updates alias for existing user', async () => {
136-
// Given
137-
vi.mocked(getSessions).mockReturnValue(JSON.stringify(mockSessions))
138-
const expectedSessions = structuredClone(mockSessions)
139-
expectedSessions['identity.fqdn.com']!.user1!.identity.alias = 'New Alias'
140-
141-
// When
142-
await updateSessionAlias('user1', 'New Alias')
143-
144-
// Then
145-
expect(setSessions).toHaveBeenCalledWith(JSON.stringify(expectedSessions))
146-
})
147-
148-
test('does nothing for non-existent user', async () => {
149-
// Given
150-
vi.mocked(getSessions).mockReturnValue(JSON.stringify(mockSessions))
151-
152-
// When
153-
await updateSessionAlias('nonexistent', 'New Alias')
154-
155-
// Then
156-
expect(setSessions).not.toHaveBeenCalled()
157-
})
158-
159-
test('does nothing when no sessions exist', async () => {
160-
// Given
161-
vi.mocked(getSessions).mockReturnValue(undefined)
162-
163-
// When
164-
await updateSessionAlias('user1', 'New Alias')
165-
166-
// Then
167-
expect(setSessions).not.toHaveBeenCalled()
168-
})
169-
170-
test('does nothing when fqdn does not exist', async () => {
171-
// Given
172-
vi.mocked(getSessions).mockReturnValue(JSON.stringify(mockSessions))
173-
vi.mocked(identityFqdn).mockResolvedValue('different.fqdn.com')
174-
175-
// When
176-
await updateSessionAlias('user1', 'New Alias')
177-
178-
// Then
179-
expect(setSessions).not.toHaveBeenCalled()
180-
})
181-
})
182-
183134
describe('findSessionByAlias', () => {
184135
test('returns userId for existing alias', async () => {
185136
// Given

packages/cli-kit/src/private/node/session/store.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -56,23 +56,6 @@ export async function getSessionAlias(userId: string): Promise<string | undefine
5656
return sessions[fqdn][userId].identity.alias
5757
}
5858

59-
/**
60-
* Updates the session alias with a more human-readable display name if available.
61-
*
62-
* @param userId - The user ID of the session to update
63-
* @param alias - The alias to update the session with
64-
*/
65-
export async function updateSessionAlias(userId: string, alias: string): Promise<void> {
66-
const sessions = await fetch()
67-
if (!sessions) return
68-
69-
const fqdn = await identityFqdn()
70-
if (!sessions[fqdn] || !sessions[fqdn][userId]) return
71-
72-
sessions[fqdn][userId].identity.alias = alias
73-
await store(sessions)
74-
}
75-
7659
/**
7760
* Finds a session by its alias.
7861
*

packages/cli-kit/src/public/node/session-prompt.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ describe('promptSessionSelect', () => {
175175

176176
// Then
177177
expect(setCurrentSessionId).toHaveBeenCalledWith('user1')
178-
expect(sessionStore.updateSessionAlias).not.toHaveBeenCalled()
179178
expect(result).toEqual('Work Account')
180179
})
181180

0 commit comments

Comments
 (0)