56 lines
2.8 KiB
TypeScript
56 lines
2.8 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import {
|
|
indexedPendingIssues,
|
|
indexedUncertainties,
|
|
sameReviewSource,
|
|
sameRewriteScope,
|
|
manualIssueError
|
|
} from '@/features/create-drama/review/model'
|
|
import { confirmationPreview, rewritePreview } from './fixtures'
|
|
|
|
describe('审核原始索引与来源保护', () => {
|
|
it('已接受第一项后,分组排序仍提交原始问题和不确定项索引', () => {
|
|
const preview = confirmationPreview()
|
|
expect(indexedPendingIssues(preview).map(row => row.originalIndex)).toEqual([1, 2])
|
|
expect(indexedUncertainties(preview).map(row => row.originalIndex)).toEqual([1])
|
|
})
|
|
it('剩余列表缺失时不伪造已处理结果', () => {
|
|
const preview = confirmationPreview()
|
|
delete preview.remainingPendingQualityIssues
|
|
delete preview.remainingUncertainty
|
|
expect(indexedPendingIssues(preview).map(row => row.originalIndex)).toEqual([0, 1, 2])
|
|
expect(indexedUncertainties(preview).map(row => row.originalIndex)).toEqual([0, 1])
|
|
})
|
|
it('审核、保存记录或正式正文变化都使本次选择失效', () => {
|
|
const preview = confirmationPreview()
|
|
expect(sameReviewSource(preview, structuredClone(preview))).toBe(true)
|
|
expect(sameReviewSource(preview, { ...preview, checkpointId: 'cp-new' })).toBe(false)
|
|
expect(sameReviewSource(preview, { ...preview, reviewId: 'review-new' })).toBe(false)
|
|
expect(sameReviewSource(preview, { ...preview, episodes: [{ episode: 1, content: '正文已变化' }] })).toBe(false)
|
|
})
|
|
it('保存记录或改写范围变化必须重新确认,集号顺序变化不视为范围变化', () => {
|
|
const preview = rewritePreview()
|
|
expect(sameRewriteScope(preview, { ...preview, episodeNumbers: [2, 1] })).toBe(true)
|
|
expect(sameRewriteScope(preview, { ...preview, checkpointId: 'new' })).toBe(false)
|
|
expect(sameRewriteScope(preview, { ...preview, rewriteWorld: true })).toBe(false)
|
|
expect(sameRewriteScope(preview, { ...preview, episodeNumbers: [1] })).toBe(false)
|
|
})
|
|
it('人工补充必须填写真实集号、逐字引用、说明和建议', () => {
|
|
const draft = {
|
|
id: 'draft',
|
|
episode: 1,
|
|
category: 'action_continuity' as const,
|
|
code: '动作衔接',
|
|
sourceQuote: '不存在的引用',
|
|
message: '核对动作',
|
|
suggestion: '补齐动作',
|
|
subjectRef: ''
|
|
}
|
|
expect(manualIssueError(draft, confirmationPreview().episodes)).toContain('原文')
|
|
expect(
|
|
manualIssueError({ ...draft, sourceQuote: '林夏放下信件后打开房门。' }, confirmationPreview().episodes)
|
|
).toBe('')
|
|
expect(manualIssueError({ ...draft, episode: 9 }, confirmationPreview().episodes)).toContain('剧集')
|
|
})
|
|
})
|