返回 oh-my-ppt
edit-deck-allpage-flow.test.ts
根目录 / tests / unit / generation / edit-deck-allpage-flow.test.ts
1 import { describe, expect, it } from 'vitest'
2 import { resolveRemainingFailedPageInfo } from '../../../src/main/generation/edit-deck-failure-state'
3
4 describe('resolveRemainingFailedPageInfo', () => {
5 it('keeps previous failures, adds new failures, and removes pages completed by this run', () => {
6 const result = resolveRemainingFailedPageInfo({
7 previousFailures: new Map([
8 ['page-old', { title: '旧失败页', reason: '旧错误' }],
9 ['page-recovered', { title: '已恢复页', reason: '旧错误' }]
10 ]),
11 failedResults: [
12 {
13 status: 'failed',
14 pageId: 'page-new',
15 reason: '本次错误',
16 retryCount: 1
17 }
18 ],
19 completedPageIds: new Set(['page-recovered']),
20 pageRefs: [
21 { pageId: 'page-old', title: '旧失败页' },
22 { pageId: 'page-recovered', title: '已恢复页' },
23 { pageId: 'page-new', title: '新失败页' }
24 ]
25 })
26
27 expect(Array.from(result.entries())).toEqual([
28 ['page-old', { title: '旧失败页', reason: '旧错误' }],
29 ['page-new', { title: '新失败页', reason: '本次错误' }]
30 ])
31 })
32 })
33
33 lines TYPESCRIPT