Phase 004: remove the desktop shell, website tooling, and bundled hermes CLI
- Drop all desktop/Electron branches, scripts, and UI (title bar, pets, desktop bridge); LAN endpoint kind is now web/custom only - Replace the bundled hermes CLI with user-side installation: add GET /api/hermes/cli-status plus a HermesMissingView onboarding guide - Remove the version-management UI (snapshots handled by git) and prune dead website/mcu/claude scripts and lockfile entries
This commit is contained in:
@@ -8,7 +8,6 @@ const mockLoginWithPassword = vi.hoisted(() => vi.fn())
|
||||
const mockSetApiKey = vi.hoisted(() => vi.fn())
|
||||
const mockClearApiKey = vi.hoisted(() => vi.fn())
|
||||
const mockHasApiKey = vi.hoisted(() => vi.fn())
|
||||
const mockIsDesktopShell = vi.hoisted(() => vi.fn())
|
||||
|
||||
vi.mock('vue-router', () => ({
|
||||
useRouter: () => ({
|
||||
@@ -33,17 +32,12 @@ vi.mock('@/api/auth', () => ({
|
||||
loginWithPassword: mockLoginWithPassword,
|
||||
}))
|
||||
|
||||
vi.mock('@/utils/desktop-bridge', () => ({
|
||||
isDesktopShell: mockIsDesktopShell,
|
||||
}))
|
||||
|
||||
import LoginView from '@/views/LoginView.vue'
|
||||
|
||||
describe('LoginView password login', () => {
|
||||
beforeEach(() => {
|
||||
delete (window as any).__LOGIN_TOKEN__
|
||||
vi.clearAllMocks()
|
||||
mockIsDesktopShell.mockReturnValue(false)
|
||||
mockHasApiKey.mockReturnValue(false)
|
||||
mockFetchAuthStatus.mockResolvedValue({ hasPasswordLogin: true, username: 'admin' })
|
||||
})
|
||||
@@ -57,16 +51,6 @@ describe('LoginView password login', () => {
|
||||
expect(mockReplace).toHaveBeenCalledWith('/hermes/chat')
|
||||
})
|
||||
|
||||
it('clears stale tokens when the desktop login page is opened', () => {
|
||||
mockIsDesktopShell.mockReturnValue(true)
|
||||
mockHasApiKey.mockReturnValue(true)
|
||||
|
||||
mount(LoginView)
|
||||
|
||||
expect(mockClearApiKey).toHaveBeenCalledOnce()
|
||||
expect(mockReplace).not.toHaveBeenCalledWith('/hermes/chat')
|
||||
})
|
||||
|
||||
it('logs in with username and password', async () => {
|
||||
mockLoginWithPassword.mockResolvedValue('jwt-token')
|
||||
const wrapper = mount(LoginView)
|
||||
@@ -121,21 +105,4 @@ describe('LoginView password login', () => {
|
||||
'hermes-ui reset-default-login',
|
||||
])
|
||||
})
|
||||
|
||||
it('shows the tray reset hint for locked desktop logins', async () => {
|
||||
mockIsDesktopShell.mockReturnValue(true)
|
||||
const err: any = new Error('Too many login attempts')
|
||||
err.status = 429
|
||||
mockLoginWithPassword.mockRejectedValue(err)
|
||||
const wrapper = mount(LoginView)
|
||||
|
||||
const inputs = wrapper.findAll('input.login-input')
|
||||
await inputs[0].setValue('admin')
|
||||
await inputs[1].setValue('123456')
|
||||
await wrapper.find('form.login-form').trigger('submit')
|
||||
|
||||
expect(wrapper.find('.login-error').text()).toBe('login.tooManyAttempts')
|
||||
expect(wrapper.find('.login-lock-hint').text()).toContain('login.desktopLockResetHint')
|
||||
expect(wrapper.findAll('.login-lock-hint code')).toHaveLength(0)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user