feat: P1 合盘/星座/问答与测测完整设计包及模拟器取证工具
落地 synastry/star/ask API 与 H5 页面,补齐 cece-frontend-re complete-design 证据文档,并加入 Android 模拟器截图抓取脚本。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
import { describe, it, expect, vi, beforeEach } from 'vitest'
|
||||
import { mount, flushPromises } from '@vue/test-utils'
|
||||
import LifeRhythmPage from './LifeRhythmPage.vue'
|
||||
|
||||
const { api } = vi.hoisted(() => ({
|
||||
api: {
|
||||
createProfile: vi.fn(),
|
||||
createRhythm: vi.fn(),
|
||||
getReport: vi.fn(),
|
||||
createOrder: vi.fn(),
|
||||
payMock: vi.fn(),
|
||||
},
|
||||
}))
|
||||
|
||||
vi.mock('../api/client', () => ({ api }))
|
||||
vi.mock('vue-router', () => ({
|
||||
useRoute: () => ({ query: { y: '1992', m: '6', d: '8' } }),
|
||||
useRouter: () => ({ back: vi.fn() }),
|
||||
}))
|
||||
|
||||
describe('LifeRhythmPage', () => {
|
||||
beforeEach(() => vi.clearAllMocks())
|
||||
|
||||
it('creates rhythm report from birth query', async () => {
|
||||
api.createProfile.mockResolvedValue({ id: 'p1' })
|
||||
api.createRhythm.mockResolvedValue({
|
||||
id: 'r-rhythm',
|
||||
type: 'rhythm',
|
||||
has_deep_access: false,
|
||||
summary: { headline: '节律标题', one_liner: '节律一句' },
|
||||
detail: null,
|
||||
})
|
||||
|
||||
const w = mount(LifeRhythmPage)
|
||||
await flushPromises()
|
||||
expect(api.createRhythm).toHaveBeenCalledWith('p1')
|
||||
expect(w.text()).toContain('节律标题')
|
||||
expect(w.text()).toContain('节气陪伴')
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user