|
1 | 1 | 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' |
3 | 3 | import {getSessions, removeSessions, setSessions, removeCurrentSessionId} from '../conf-store.js' |
4 | 4 | import {identityFqdn} from '../../../public/node/context/fqdn.js' |
5 | 5 | import {describe, expect, vi, test, beforeEach} from 'vitest' |
@@ -131,55 +131,6 @@ describe('session store', () => { |
131 | 131 | }) |
132 | 132 | }) |
133 | 133 |
|
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 | | - |
183 | 134 | describe('findSessionByAlias', () => { |
184 | 135 | test('returns userId for existing alias', async () => { |
185 | 136 | // Given |
|
0 commit comments