29 lines
1.6 KiB
TypeScript
29 lines
1.6 KiB
TypeScript
import { readFileSync } from 'node:fs'
|
|||
|
|
import { resolve } from 'node:path'
|
||
|
|
import { describe, expect, it } from 'vitest'
|
||
|
|
|
||
|
|
const apiSource = readFileSync(resolve(process.cwd(), 'src/modules/overseas-warehouse/api/lastMileOrders.ts'), 'utf8')
|
||
|
|
const pageSource = readFileSync(resolve(process.cwd(), 'src/modules/overseas-warehouse/pages/LastMileOrdersView.vue'), 'utf8')
|
||
|
|
|
||
|
|
describe('container inbound plan preview contract', () => {
|
||
|
|
it('uses the backend preview endpoint with the stable container booking id', () => {
|
||
|
|
expect(apiSource).toContain("'/platform/v1/last-leg/inbound-plans/container-preview'")
|
||
|
|
expect(apiSource).toContain('{ params: { sourceContainerBookingId } }')
|
||
|
|
})
|
||
|
|
|
||
|
|
it('renders backend groups, pallet totals, readiness and blockers without local grouping or sorting', () => {
|
||
|
|
expect(pageSource).toContain('containerPreview.pendingPalletCount')
|
||
|
|
expect(pageSource).toContain('containerPreview.existingPlannedPalletCount')
|
||
|
|
expect(pageSource).toContain('v-for="group in containerPreview.groups"')
|
||
|
|
expect(pageSource).toContain('readinessText(row.readiness)')
|
||
|
|
expect(pageSource).toContain('blockerText(row.blockers)')
|
||
|
|
expect(pageSource).not.toContain('containerPreview.groups.sort(')
|
||
|
|
})
|
||
|
|
|
||
|
|
it('requests one preview per selection and does not submit the legacy conversion command', () => {
|
||
|
|
expect(pageSource.match(/await getContainerInboundPlanPreview\(sourceContainerBookingId\)/g)).toHaveLength(1)
|
||
|
|
expect(pageSource).not.toContain('convertLastMileContainerToInboundPlans')
|
||
|
|
expect(pageSource).toContain(':confirm-disabled="true"')
|
||
|
|
})
|
||
|
|
})
|