You've already forked agentic-coding-workflow
test(web): smoke tests for ACP session list/create views
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
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')
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,44 @@
|
||||
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().mockResolvedValue([]),
|
||||
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('vue-router', () => ({
|
||||
useRoute: () => ({ params: { slug: 'p', wsSlug: 'w' } }),
|
||||
useRouter: () => ({ push: vi.fn() }),
|
||||
}))
|
||||
|
||||
import AcpSessionListView from './AcpSessionListView.vue'
|
||||
|
||||
beforeEach(() => {
|
||||
setActivePinia(createPinia())
|
||||
})
|
||||
|
||||
describe('AcpSessionListView', () => {
|
||||
it('mounts without error and shows empty state', async () => {
|
||||
const wrapper = mount(AcpSessionListView)
|
||||
await new Promise((r) => setTimeout(r, 20))
|
||||
const html = wrapper.html()
|
||||
expect(html).toContain('ACP Sessions')
|
||||
expect(html).toContain('No sessions yet')
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user