协议样本、生产产出和盘点明细按行更新并保留原 id;补齐存储证明质检预填、离职人员显示名,以及样本采集通知模板字段。 Co-authored-by: Cursor <cursoragent@cursor.com>
34 lines
1.3 KiB
TypeScript
34 lines
1.3 KiB
TypeScript
import { describe, it } from 'node:test'
|
|
import assert from 'node:assert/strict'
|
|
import { createEmptyStepOutputRow, toStepOutputReplaceItem } from './production-step-output'
|
|
|
|
describe('createEmptyStepOutputRow', () => {
|
|
it('defaults barcode to lab storage code', () => {
|
|
const row = createEmptyStepOutputRow('LAB-001')
|
|
assert.equal(row.outputBarcode, 'LAB-001')
|
|
assert.equal(row.outputTypeId, '')
|
|
assert.equal(row.outputName, '')
|
|
assert.equal(row.remark, '')
|
|
})
|
|
|
|
it('trims lab storage code', () => {
|
|
assert.equal(createEmptyStepOutputRow(' LAB-002 ').outputBarcode, 'LAB-002')
|
|
})
|
|
|
|
it('uses empty barcode when lab storage code is missing', () => {
|
|
assert.equal(createEmptyStepOutputRow('').outputBarcode, '')
|
|
assert.equal(createEmptyStepOutputRow(null).outputBarcode, '')
|
|
assert.equal(createEmptyStepOutputRow(undefined).outputBarcode, '')
|
|
})
|
|
|
|
it('assigns a stable id and keeps it when building the save payload', () => {
|
|
const row = createEmptyStepOutputRow('LAB-001')
|
|
assert.match(row.id, /^[0-9A-F]{32}$/)
|
|
const first = toStepOutputReplaceItem(row)
|
|
const second = toStepOutputReplaceItem(row)
|
|
assert.equal(first.id, row.id)
|
|
assert.equal(second.id, row.id)
|
|
assert.equal(first.output_barcode, 'LAB-001')
|
|
})
|
|
})
|