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"/)
|
2026-09-03 17:49:09 +08:00
|
|
|
assert.match(source, /费用已发布 · 待确认/)
|
2026-08-04 21:01:34 +08:00
|
|
|
assert.match(source, /\$emit\('retry'\)/)
|
|
|
|
|
})
|
|
|
|
|
|
2026-09-04 12:00:33 +08:00
|
|
|
test('supports a standalone dialog and keeps the unpushed billing-weight state visible', () => {
|
|
|
|
|
assert.match(source, /dialogOnly\?: boolean/)
|
|
|
|
|
assert.match(source, /v-if="!props\.dialogOnly"/)
|
|
|
|
|
assert.match(source, /watch\(\(\) => props\.autoOpen/)
|
|
|
|
|
assert.match(source, /if \(autoOpen\) feeDialogOpen\.value = true/)
|
|
|
|
|
assert.match(source, /v-else-if="props\.unavailable \|\| !props\.data"/)
|
2026-10-20 11:54:44 +08:00
|
|
|
assert.match(source, /平台推送费用后,可在这里核对并确认/)
|
2026-09-04 12:00:33 +08:00
|
|
|
assert.match(source, /@closed="emit\('closed'\)"/)
|
|
|
|
|
})
|
|
|
|
|
|
2026-09-03 17:49:09 +08:00
|
|
|
test('shows the published merchant inbound, measurement details and customer confirmation entry', () => {
|
2026-09-23 17:47:56 +08:00
|
|
|
for (const label of ['入仓码', '平台收货仓', '实际毛重', '实测体积', '托盘与库位', '换算与精度', '最终计费量', '单价', '基础费用', '附加费用', '费用合计', '平台备注']) {
|
|
|
|
|
assert.ok(source.includes(label), `missing label: ${label}`)
|
2026-08-04 21:01:34 +08:00
|
|
|
}
|
|
|
|
|
assert.match(source, /formatInboundMoney\(props\.data\.latestFee\.totalAmount/)
|
2026-08-29 11:45:57 +08:00
|
|
|
assert.match(source, /formatConversionPrecision\(/)
|
2026-10-20 17:59:06 +08:00
|
|
|
assert.match(source, /title="确认计费重"/)
|
2026-09-23 17:47:56 +08:00
|
|
|
assert.match(source, /确认后当前费用版本将锁定/)
|
2026-09-03 17:49:09 +08:00
|
|
|
assert.match(source, /customerConfirmationStatus === 'CONFIRMED'/)
|
|
|
|
|
assert.match(source, /confirmMerchantInboundFee/)
|
2026-09-03 10:46:14 +08:00
|
|
|
assert.match(source, /measurementItems/)
|
|
|
|
|
assert.doesNotMatch(source, /调整费用|发送费用|下载照片/)
|
2026-08-04 21:01:34 +08:00
|
|
|
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/)
|
2026-09-21 19:36:37 +08:00
|
|
|
assert.match(source, /箱规规则/)
|
|
|
|
|
assert.match(source, /getCalculationRuleLabel\(row\.calculationRuleVersion\)/)
|
2026-08-04 21:01:34 +08:00
|
|
|
})
|
|
|
|
|
|
2026-09-23 17:47:56 +08:00
|
|
|
test('matches the confirmed billing prototype summary, table, notice and footer', () => {
|
|
|
|
|
assert.match(source, /width="min\(1180px, calc\(100vw - 40px\)\)"/)
|
|
|
|
|
assert.match(source, /class="fee-dialog-summary" aria-label="计费汇总"/)
|
|
|
|
|
for (const label of ['计算重', '单价', '总金额', '箱规长(cm)', '箱规宽(cm)', '箱规高(cm)', '每箱体积', '总体积', '总材积重']) assert.ok(source.includes(label), `missing prototype label: ${label}`)
|
|
|
|
|
assert.match(source, /class="fee-confirm-notice"/)
|
|
|
|
|
assert.match(source, /请核对计算重、单价和总金额。确认后当前费用版本将锁定。/)
|
|
|
|
|
assert.match(source, /确认计费量和费用/)
|
|
|
|
|
assert.match(source, /\.fee-dialog-summary \{ display:grid; grid-template-columns:repeat\(3,minmax\(0,1fr\)\)/)
|
|
|
|
|
assert.match(source, /\.fee-dialog-table :deep\(\.el-table__body td\.el-table__cell\)/)
|
|
|
|
|
})
|
|
|
|
|
|
2026-08-04 21:01:34 +08:00
|
|
|
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\)/)
|
|
|
|
|
})
|