36 lines
1.1 KiB
TypeScript
36 lines
1.1 KiB
TypeScript
// dacli/tests/unit/verify-runner.test.ts
|
|
import { describe, it, expect, vi, beforeEach } from 'vitest'
|
|
import { checkDeps, runVerify } from '../../src/core/verify-runner'
|
|
|
|
describe('checkDeps', () => {
|
|
beforeEach(() => {
|
|
vi.restoreAllMocks()
|
|
})
|
|
|
|
it('探测到 playwright + chromium + jnpf 全部就绪时全 true', async () => {
|
|
// 假设: 全装
|
|
const deps = await checkDeps()
|
|
expect(deps).toMatchObject({
|
|
playwright: true,
|
|
chromium: true,
|
|
jnpf: true,
|
|
menuMounted: expect.any(Boolean),
|
|
})
|
|
})
|
|
|
|
it('playwright 未装时返 playwright=false', async () => {
|
|
// 不测 (依赖环境), 仅文档化期望
|
|
})
|
|
})
|
|
|
|
describe('runVerify', () => {
|
|
it('子进程 stdout 返 JSON ok=true 时透传 (真实 paymentapply 跑通)', async () => {
|
|
const result = await runVerify('585398402720727621', 'paymentapply', 'workSystem', {
|
|
timeout: 60000,
|
|
})
|
|
expect(result).toHaveProperty('ok')
|
|
expect(result).toHaveProperty('steps')
|
|
expect(result).toHaveProperty('screenshots')
|
|
}, 90000) // 90s vitest timeout
|
|
})
|