import test from 'node:test' import assert from 'node:assert/strict' import { readFile } from 'node:fs/promises' const page = await readFile(new URL('../src/pages/relabel/relabel.vue', import.meta.url), 'utf8') const helper = await readFile(new URL('../src/utils/return-relabel.js', import.meta.url), 'utf8') const { returnDeductions } = await import('data:text/javascript;base64,' + Buffer.from(helper).toString('base64')) test('return carton label path requires source confirmation before carton scan', () => { assert.match(page, /退货箱唛换标必须先确认同一来源包裹\/箱/) assert.match(page, /this\.taskTab === 'carton' \? 'quick-carton' : 'quick-sku'/) }) test('mixed return carton keeps one physical package while SKU deductions use pieces', () => { const task={items:[{returnCartonId:'1',cartonMark:'P1',operationType:'CARTON_AND_SKU',returnQuantity:5,skuItems:[{skuCode:'S',quantity:5}]}]} assert.deepEqual(returnDeductions(task),[{cartonMark:'P1',skuCode:'S',quantity:5}]) })