feat: 前端接入内容归属与结构化报告

This commit is contained in:
2026-10-09 19:32:44 +08:00
parent e52682c352
commit 18a2580c45
28 changed files with 1793 additions and 160 deletions
+7 -6
View File
@@ -182,23 +182,24 @@ describe('StartTask.vue', () => {
wrapper.unmount()
})
it('endTimer refuses empty content without calling API', async () => {
it('endTimer refuses an empty three-section report without calling API', async () => {
const wrapper = await mountTask()
await wrapper.vm.endTimer('')
await wrapper.vm.endTimer({ sessionSummary: '', expectationVerdict: '', freeSummary: ' ' })
expect(ElMessage.warning).toHaveBeenCalledWith('请输入学习总结内容')
expect(endSession).not.toHaveBeenCalled()
wrapper.unmount()
})
it('endTimer ends session and navigates to study page', async () => {
it('endTimer submits all three sections and navigates to study page', async () => {
vi.mocked(endSession).mockResolvedValue({ code: 200, message: '请求成功' } as any)
const wrapper = await mountTask()
await wrapper.vm.endTimer('学习总结内容')
const sections = { sessionSummary: '摘要', expectationVerdict: '判断', freeSummary: '自由总结' }
await wrapper.vm.endTimer(sections)
expect(endSession).toHaveBeenCalledWith('SESSION_001', '学习总结内容')
expect(endSession).toHaveBeenCalledWith('SESSION_001', sections)
expect(ElMessage.success).toHaveBeenCalledWith('任务结束')
expect(localStorage.getItem('activeSession')).toBeNull()
expect(router.currentRoute.value.path).toBe('/study')
@@ -212,7 +213,7 @@ describe('StartTask.vue', () => {
} as any)
const wrapper = await mountTask()
await wrapper.vm.endTimer('学习总结内容')
await wrapper.vm.endTimer({ sessionSummary: '摘要', expectationVerdict: '', freeSummary: '' })
expect(ElMessage.warning).toHaveBeenCalledWith('本次有效学习时间不足10分钟,不计入总学习时间')
wrapper.unmount()