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(' { expect(source).toContain("detail.planStatus === 'COMPLETED' && overview?.loadingPlanId && canListCustoms") expect(source).toContain(' { 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) } }) })