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

37 lines
1.9 KiB
JavaScript
Raw Normal View History

2026-08-04 21:01:34 +08:00
import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
import test from 'node:test'
const source = readFileSync(new URL('./InboundBillingPanel.vue', import.meta.url), 'utf8')
test('renders loading, pending, isolated error, and published states', () => {
assert.match(source, /v-if="props\.loading"/)
assert.match(source, /v-else-if="props\.error"/)
assert.match(source, /role="alert"/)
assert.match(source, /v-else-if="props\.unavailable \|\| !props\.data"/)
assert.match(source, /role="status"/)
assert.match(source, /已入库 · 费用已发布/)
assert.match(source, /\$emit\('retry'\)/)
})
test('shows the confirmed merchant inbound and fee fields without write actions', () => {
for (const label of ['入仓码', '平台收货仓', '实际毛重', '实测体积', '托盘与库位', '换算与精度', '最终计费量', '基础费用', '附加费用', '费用合计', '平台备注']) {
assert.match(source, new RegExp(label))
}
assert.match(source, /formatInboundMoney\(props\.data\.latestFee\.totalAmount/)
assert.match(source, /getRoundingModeLabel\(props\.data\.latestFee\.roundingMode\)/)
assert.doesNotMatch(source, /确认费用|调整费用|发送费用|下载照片/)
assert.doesNotMatch(source, /internalNotes|statusHistory|files/)
assert.match(source, /latestFee\.ruleCode/)
assert.match(source, /latestFee\.rateCode/)
assert.match(source, /latestFee\.chargeRuleVersion/)
assert.match(source, /latestFee\.carrierRateVersion/)
})
test('stacks core information for 720 and 360 pixel layouts', () => {
assert.match(source, /@media \(max-width: 720px\)/)
assert.match(source, /\.inbound-overview, \.inbound-measurements, \.fee-calculation-grid \{ grid-template-columns: 1fr;/)
assert.match(source, /\.inbound-billing-state \.el-button \{[^}]*min-height: 44px;/)
assert.match(source, /@media \(max-width: 360px\)/)
})