21 lines
1.0 KiB
TypeScript
21 lines
1.0 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|||
|
|
import { readFileSync } from 'node:fs'
|
||
|
|
import { resolve } from 'node:path'
|
||
|
|
|
||
|
|
const source = readFileSync(resolve(process.cwd(), 'src/modules/trucking/pages/TruckAppointmentCreateView.vue'), 'utf8')
|
||
|
|
|
||
|
|
describe('TruckAppointmentCreateView independent creation contract', () => {
|
||
|
|
it('starts with optional associations cleared and keeps required business fields explicit', () => {
|
||
|
|
expect(source).toContain('customerId: null, carrierId: null')
|
||
|
|
expect(source).toContain('oceanBookingId: null, containerBookingId: null, loadingPlanId: null')
|
||
|
|
expect(source).toContain('plannedLoadingAt: null')
|
||
|
|
expect(source).toContain('createTruckAppointment({ ...form })')
|
||
|
|
})
|
||
|
|
|
||
|
|
it('keeps the form visible and exposes the real backend error details', () => {
|
||
|
|
expect(source).toContain("getApiErrorDetails(err, '创建失败,请稍后重试')")
|
||
|
|
expect(source).toContain('<ApiErrorMeta :details="error" />')
|
||
|
|
expect(source).toContain('<TruckAppointmentForm v-model="form"')
|
||
|
|
})
|
||
|
|
})
|