Add history import controls (#1053)

This commit is contained in:
ekko
2026-05-27 10:05:52 +08:00
committed by GitHub
parent 3cede6fb7f
commit a10e171082
16 changed files with 718 additions and 17 deletions
+15 -1
View File
@@ -15,7 +15,7 @@ vi.mock('@/router', () => ({
import { getApiKey, setApiKey, clearApiKey, hasApiKey, getStoredUserRole, isStoredSuperAdmin, request } from '../../packages/client/src/api/client'
import { getDownloadUrl } from '../../packages/client/src/api/hermes/download'
import { uploadFiles } from '../../packages/client/src/api/hermes/files'
import { batchDeleteSessions } from '../../packages/client/src/api/hermes/sessions'
import { batchDeleteSessions, importHermesSession } from '../../packages/client/src/api/hermes/sessions'
import router from '@/router'
function fakeJwt(payload: Record<string, unknown>) {
@@ -230,5 +230,19 @@ describe('API Client', () => {
],
})
})
it('sends the profile selector when importing a Hermes session', async () => {
mockFetch.mockResolvedValue({
ok: true,
status: 200,
json: () => Promise.resolve({ ok: true, imported: true }),
})
await importHermesSession('cli-1', 'travel')
const [url, options] = mockFetch.mock.calls[0]
expect(url).toBe('/api/hermes/sessions/hermes/cli-1/import?profile=travel')
expect(options.method).toBe('POST')
})
})
})