Files
client-web/src/modules/first-leg/components/InboundCodeAssociationDialog.test.mjs
T

33 lines
1.5 KiB
JavaScript
Raw Normal View History

import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
import test from 'node:test'
const source = readFileSync(new URL('./InboundCodeAssociationDialog.vue', import.meta.url), 'utf8')
test('loads only the customer-scoped server association and fails closed', () => {
assert.match(source, /getMerchantInboundCodeAssociation\(inboundCode\)/)
assert.match(source, /association\.value = null/)
assert.match(source, /关联摘要加载失败/)
assert.match(source, /@click="loadAssociation"/)
assert.doesNotMatch(source, /orderId\)|customerId\)|destinationWarehouseId\)/)
})
test('renders business identifiers and names without internal long identifiers', () => {
for (const label of ['入仓码', '订单号', '订单状态', '客户名称', '目的国家', '目的仓']) {
assert.match(source, new RegExp(label))
}
assert.match(source, /association\.inboundCode/)
assert.match(source, /association\.orderNo/)
assert.match(source, /association\.customerName/)
assert.match(source, /destinationWarehouseCode/)
assert.match(source, /destinationWarehouseName/)
assert.doesNotMatch(source, /association\.(?:orderId|customerId|destinationWarehouseId)/)
assert.match(source, /\|\| '—'/)
})
test('uses a bounded centered summary dialog suitable for the desktop detail flow', () => {
assert.match(source, /<el-dialog[^>]*width="620px"/)
assert.match(source, /grid-template-columns: repeat\(2, minmax\(0, 1fr\)\)/)
assert.match(source, /min-height: 190px/)
})