initialize Electron desktop app and remove unused files
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
// @vitest-environment jsdom
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { mount } from '@vue/test-utils'
|
||||
import { createTestingPinia } from '@pinia/testing'
|
||||
import ArcoVue from '@arco-design/web-vue'
|
||||
|
||||
const routerPush = vi.hoisted(() => vi.fn())
|
||||
|
||||
vi.mock('vue-router', async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import('vue-router')>()
|
||||
return {
|
||||
...actual,
|
||||
useRouter: () => ({ push: routerPush }),
|
||||
}
|
||||
})
|
||||
|
||||
vi.mock('vue-i18n', () => ({
|
||||
useI18n: () => ({ t: (key: string) => key }),
|
||||
}))
|
||||
|
||||
vi.mock('@/composables/useMessage', () => ({
|
||||
useMessage: () => ({ success: vi.fn(), error: vi.fn() }),
|
||||
}))
|
||||
|
||||
vi.mock('@/composables/useDialog', () => ({
|
||||
useDialog: () => ({ warning: vi.fn() }),
|
||||
}))
|
||||
|
||||
import ProfileCard from '@/components/hermes/profiles/ProfileCard.vue'
|
||||
|
||||
function actionButton(wrapper: any, text: string) {
|
||||
const button = wrapper
|
||||
.findAll('.cy-panel-actions button')
|
||||
.find((node: any) => node.text().trim() === text)
|
||||
if (!button) throw new Error(`no card action labelled "${text}"`)
|
||||
return button
|
||||
}
|
||||
|
||||
describe('ProfileCard config edit affordance', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks()
|
||||
})
|
||||
|
||||
it('routes to the scoped config editor for that profile', async () => {
|
||||
const wrapper = mount(ProfileCard, {
|
||||
props: {
|
||||
profile: {
|
||||
name: 'reviewer',
|
||||
active: false,
|
||||
model: 'gpt-5.4',
|
||||
alias: 'reviewer',
|
||||
avatar: null,
|
||||
},
|
||||
},
|
||||
global: {
|
||||
plugins: [createTestingPinia({ createSpy: vi.fn }), ArcoVue],
|
||||
stubs: {
|
||||
ProfileAvatar: { template: '<span class="profile-avatar-stub" />' },
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
await actionButton(wrapper, 'profiles.editConfig').trigger('click')
|
||||
|
||||
expect(routerPush).toHaveBeenCalledWith({
|
||||
name: 'hermes.files',
|
||||
query: {
|
||||
profile: 'reviewer',
|
||||
file: 'config.yaml',
|
||||
},
|
||||
})
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user