You've already forked agentic-coding-workflow
67 lines
1.6 KiB
TypeScript
67 lines
1.6 KiB
TypeScript
import { describe, it, expect, vi, beforeEach } from 'vitest'
|
|
import { mount } from '@vue/test-utils'
|
|
import { createPinia, setActivePinia } from 'pinia'
|
|
|
|
vi.mock('@/api/acp', () => ({
|
|
acpApi: {
|
|
sessions: {
|
|
list: vi.fn(),
|
|
get: vi.fn(),
|
|
create: vi.fn(),
|
|
terminate: vi.fn(),
|
|
events: vi.fn(),
|
|
},
|
|
agentKinds: {
|
|
list: vi.fn().mockResolvedValue([]),
|
|
get: vi.fn(),
|
|
create: vi.fn(),
|
|
update: vi.fn(),
|
|
remove: vi.fn(),
|
|
},
|
|
},
|
|
isAgentKindAdmin: () => false,
|
|
}))
|
|
|
|
vi.mock('@/api/workspaces', () => ({
|
|
workspacesApi: {
|
|
list: vi.fn().mockResolvedValue([]),
|
|
get: vi.fn(),
|
|
create: vi.fn(),
|
|
update: vi.fn(),
|
|
delete: vi.fn(),
|
|
sync: vi.fn(),
|
|
upsertCredential: vi.fn(),
|
|
getCredential: vi.fn(),
|
|
listWorktrees: vi.fn(),
|
|
createWorktree: vi.fn(),
|
|
deleteWorktree: vi.fn(),
|
|
acquire: vi.fn(),
|
|
release: vi.fn(),
|
|
statusOnMain: vi.fn(),
|
|
commitOnMain: vi.fn(),
|
|
pushOnMain: vi.fn(),
|
|
statusOnWorktree: vi.fn(),
|
|
commitOnWorktree: vi.fn(),
|
|
pushOnWorktree: vi.fn(),
|
|
},
|
|
}))
|
|
|
|
vi.mock('vue-router', () => ({
|
|
useRoute: () => ({ params: { slug: 'p', wsSlug: 'w' } }),
|
|
useRouter: () => ({ push: vi.fn() }),
|
|
}))
|
|
|
|
import AcpSessionCreateView from './AcpSessionCreateView.vue'
|
|
|
|
beforeEach(() => {
|
|
setActivePinia(createPinia())
|
|
})
|
|
|
|
describe('AcpSessionCreateView', () => {
|
|
it('mounts without error', async () => {
|
|
const wrapper = mount(AcpSessionCreateView)
|
|
await new Promise((r) => setTimeout(r, 20))
|
|
expect(wrapper.html()).toContain('New ACP Session')
|
|
})
|
|
})
|