このコミットが含まれているのは:
@@ -1,6 +1,10 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
import { creatableImportRows,
|
||||
canEditResultRow,
|
||||
canEditReviewRow,
|
||||
canRetryResultRow,
|
||||
hasExactSourceRows,
|
||||
initialisePreviewRows,
|
||||
mergeImportResults,
|
||||
mergeValidatedImportRow,
|
||||
@@ -161,6 +165,38 @@ describe ('post import row state', () => {
|
||||
expect (resultRepairMode ([complete])).toBe ('all')
|
||||
})
|
||||
|
||||
it ('classifies editable and retryable rows by terminal and recoverable state', () => {
|
||||
const ready = buildPostImportRow ()
|
||||
const skipped = buildPostImportRow ({
|
||||
importStatus: 'skipped',
|
||||
skipReason: 'existing',
|
||||
existingPostId: 2 })
|
||||
const hardFailed = buildPostImportRow ({
|
||||
importStatus: 'failed',
|
||||
importErrors: { base: ['failed'] } })
|
||||
const pendingInvalid = buildPostImportRow ({
|
||||
importStatus: 'pending',
|
||||
recoverable: true,
|
||||
validationErrors: { title: ['invalid'] } })
|
||||
const pendingValid = buildPostImportRow ({
|
||||
importStatus: 'pending',
|
||||
recoverable: true })
|
||||
|
||||
expect (canEditReviewRow (ready)).toBe (true)
|
||||
expect (canEditReviewRow (skipped)).toBe (false)
|
||||
expect (canEditReviewRow (hardFailed)).toBe (false)
|
||||
expect (canEditResultRow (pendingInvalid)).toBe (true)
|
||||
expect (canRetryResultRow (pendingInvalid)).toBe (false)
|
||||
expect (canRetryResultRow (pendingValid)).toBe (true)
|
||||
})
|
||||
|
||||
it ('detects missing, duplicate, and extra source rows exactly', () => {
|
||||
expect (hasExactSourceRows ([1, 2], [{ sourceRow: 1 }, { sourceRow: 2 }])).toBe (true)
|
||||
expect (hasExactSourceRows ([1, 2], [{ sourceRow: 1 }])).toBe (false)
|
||||
expect (hasExactSourceRows ([1, 2], [{ sourceRow: 1 }, { sourceRow: 1 }])).toBe (false)
|
||||
expect (hasExactSourceRows ([1, 2], [{ sourceRow: 1 }, { sourceRow: 3 }])).toBe (false)
|
||||
})
|
||||
|
||||
it ('merges only the validated source row and preserves other row edits', () => {
|
||||
const edited = buildPostImportRow ({
|
||||
sourceRow: 1,
|
||||
|
||||
新しい課題から参照
ユーザをブロックする