55 lines
2.5 KiB
TypeScript
55 lines
2.5 KiB
TypeScript
import { readFileSync } from 'node:fs'
|
|
import { resolve } from 'node:path'
|
|
import { describe, expect, it } from 'vitest'
|
|
|
|
const source = readFileSync(resolve(process.cwd(), 'src/modules/container-loading/pages/ContainerDetailView.vue'), 'utf8')
|
|
const overviewSource = readFileSync(resolve(process.cwd(), 'src/modules/container-loading/components/ContainerOverviewPanel.vue'), 'utf8')
|
|
|
|
describe('ContainerDetailView customs integration', () => {
|
|
it('renders the requested detail sections in the confirmed business order', () => {
|
|
const headings = [
|
|
'container-information-heading">货柜信息',
|
|
'container-voyage-heading">船名航次信息',
|
|
'container-customs-heading">报关清关信息',
|
|
'container-receiving-heading">签收信息',
|
|
'container-fees-heading">费用明细',
|
|
]
|
|
let previous = -1
|
|
for (const heading of headings) {
|
|
const current = source.indexOf(heading)
|
|
expect(current, heading).toBeGreaterThan(previous)
|
|
previous = current
|
|
}
|
|
})
|
|
|
|
it('reuses the current schedule, customs, receipt and container-fee capabilities', () => {
|
|
expect(source).toContain('<CarrierScheduleQueryPanel')
|
|
expect(source).toContain(':sections="[\'documents\']"')
|
|
expect(source).toContain(':sections="[\'pda\']"')
|
|
expect(source).toContain('<ContainerFeesPanel')
|
|
expect(source).toContain('getConfirmedLoadingList')
|
|
expect(source).toContain('getPreloadPlan')
|
|
})
|
|
|
|
it('mounts the new container customs panel only after loading completes', () => {
|
|
expect(source).toContain("detail.planStatus === 'COMPLETED' && overview?.loadingPlanId && canListCustoms")
|
|
expect(source).toContain('<ContainerCustomsPanel')
|
|
expect(source).toContain(':loading-plan-id="overview.loadingPlanId"')
|
|
expect(source).toContain(':can-manage="canManageCustoms"')
|
|
})
|
|
|
|
it('allows the overview panel to render only the section owned by each detail group', () => {
|
|
expect(overviewSource).toContain("sections?: Array<'exception' | 'documents' | 'pda'>")
|
|
expect(overviewSource).toContain("visibleSections.has('exception')")
|
|
expect(overviewSource).toContain("visibleSections.has('documents')")
|
|
expect(overviewSource).toContain("visibleSections.has('pda')")
|
|
})
|
|
|
|
it('removes the retired loading-list customs UI and calls', () => {
|
|
for (const retired of ['getLoadingDeclaration', 'uploadLoadingDeclaration', 'completeLoadingDeclaration', 'downloadLoadingDeclaration', 'CUSTOMS_DECLARATION']) {
|
|
expect(source).not.toContain(retired)
|
|
expect(overviewSource).not.toContain(retired)
|
|
}
|
|
})
|
|
})
|