2026-08-11 11:26:31 +08:00
import { describe , expect , it } from 'vitest'
import { readFileSync } from 'node:fs'
import { resolve } from 'node:path'
const source = readFileSync ( resolve ( process . cwd (), 'src/modules/customs/pages/CustomsCasesView.vue' ), 'utf8' )
2026-08-11 18:06:35 +08:00
describe ( 'CustomsCasesView' , () => {
it ( 'uses shared list and dialog components' , () => { expect ( source ). toContain ( 'QueryToolbar' ); expect ( source ). toContain ( 'DataTable' ); expect ( source ). toContain ( 'AppDialog' ); expect ( source ). toContain ( "fixed: 'left'" ) })
2026-08-11 19:59:15 +08:00
it ( 'supports detail, history and agent submission' , () => { expect ( source ). toContain ( 'getCustomsCase' ); expect ( source ). toContain ( 'submitCustomsCase' ); expect ( source ). toContain ( 'detail.history' ) })
2026-08-11 18:43:56 +08:00
it ( 'localizes backend statuses and timeline actions throughout the page' , () => {
expect ( source ). toContain ( 'customsCaseStatusOptions' )
expect ( source ). toContain ( ':status="customsStatusLabel(row.status)"' )
expect ( source ). toContain ( ':status="customsStatusLabel(detail.customsCase.status)"' )
expect ( source ). toContain ( 'customsHistoryActionLabel(entry.action)' )
expect ( source ). toContain ( 'customsStatusLabel(entry.fromStatus)' )
expect ( source ). toContain ( "detail.value?.customsCase.status === 'READY_TO_SUBMIT'" )
expect ( source ). not . toContain ( "['DRAFT', 'COLLECTING', 'READY', 'SUBMITTED', 'RELEASED', 'REJECTED']" )
})
2026-08-11 19:59:15 +08:00
it ( 'does not expose internal id inputs while resource query APIs are unavailable' , () => {
expect ( source ). not . toContain ( 'createCustomsCase' )
expect ( source ). not . toContain ( '新增报关' )
expect ( source ). not . toContain ( '资料清单版本 ID' )
expect ( source ). not . toContain ( "key: 'orderId', type: 'input'" )
expect ( source ). not . toContain ( "key: 'inboundId', type: 'input'" )
2026-08-11 18:06:35 +08:00
})
})