This commit is contained in:
2026-08-07 20:07:37 +08:00
parent 28d0b81c5a
commit 99413ee155
27 changed files with 1065 additions and 595 deletions
@@ -14,29 +14,29 @@ describe('WeightOcrPanel contract', () => {
expect(template).not.toContain('租户')
})
it('covers upload, preview, OCR retry, inline correction, confirmation, and server totals', () => {
it('covers upload, immediate preview, inline correction, deletion, confirmation, and server totals', () => {
expect(source).toContain('uploadWeightImage')
expect(source).toContain('downloadWeightImage')
expect(source).toContain('retryWeightRecognition')
expect(source).toContain('correctWeightResult')
expect(source).toContain('await openPreview(created, URL.createObjectURL(file))')
expect(source).toContain('previewShowsRecognition.value = Boolean(localUrl)')
expect(source).toContain('deleteWeightResult')
expect(source).toContain('confirmWeightResult')
expect(source).toContain('实际总毛重(服务端汇总)')
expect(source).toContain('称重图片序号 #{{ index + 1 }}')
expect(source).toContain('workspace.value?.actualGrossWeightKg')
expect(source).toContain('v-model="weightDrafts[row.id].value"')
expect(source).toContain('识别值已自动填入,可修改后直接确认保存。')
expect(source).toContain('class="weight-card__value"')
expect(source).toContain('v-model="weightDrafts[previewResult.id].value"')
expect(source).toContain('识别重量')
expect(source).toContain('payload.adjustedWeightValue = Number(draft.value)')
expect(source).toContain('payload.adjustmentReason = buildAdjustmentReason(row)')
expect(source).not.toContain('version = corrected.version')
expect(source).not.toContain('title="人工修正重量"')
})
it('matches backend image limits and preserves missing OCR text honestly', () => {
it('matches backend image limits and keeps technical OCR data out of the list', () => {
expect(source).toContain("['image/jpeg', 'image/png', 'image/bmp']")
expect(source).toContain('5 * 1024 * 1024')
expect(source).toContain('图片服务未返回 OCR 原文')
expect(source).toContain('ocrRawText: getWeightOcrRawText(upload)')
expect(source).toContain("adjustmentReason: 'OCR 重试识别结果'")
const template = source.match(/<template>([\s\S]*?)<\/template>/)?.[1] || ''
expect(template).not.toContain('置信度')
expect(template).not.toContain('OCR 原文')
expect(template).not.toContain('提供方')
expect(template).not.toContain('文件 ID')
})
it('gates every action with the implemented permissions and editable statuses', () => {