mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 15:48:11 +00:00
- Added ClearanceCard component to display and manage clearance documents in ReadonlyBookingView. - Introduced new API endpoints for clearance operations: getClearance, submitClearanceDocuments, and proceedToOperation. - Created BookingDocumentReview entity and migration for document review status tracking. - Developed GlClearancePage for Global Logistics to review and manage document submissions. - Implemented utility functions for determining clearance setting codes based on trade direction and freight type. - Added tests for booking transition clearance logic and clearance utility functions.
50 lines
1.7 KiB
TypeScript
50 lines
1.7 KiB
TypeScript
import {
|
|
clearanceSettingCode,
|
|
clearanceOutputSettingCode,
|
|
} from './clearance.util';
|
|
|
|
describe('clearance.util — clearanceSettingCode', () => {
|
|
it('resolves import container with/without customs', () => {
|
|
expect(clearanceSettingCode('IMPORT', 'CONTAINER', true)).toBe(
|
|
'clearance_import_container_with_customs',
|
|
);
|
|
expect(clearanceSettingCode('IMPORT', 'CONTAINER', false)).toBe(
|
|
'clearance_import_container_without_customs',
|
|
);
|
|
});
|
|
|
|
it('resolves export bulk with/without customs', () => {
|
|
expect(clearanceSettingCode('EXPORT', 'BULK', true)).toBe(
|
|
'clearance_export_bulk_with_customs',
|
|
);
|
|
expect(clearanceSettingCode('EXPORT', 'BULK', false)).toBe(
|
|
'clearance_export_bulk_without_customs',
|
|
);
|
|
});
|
|
|
|
it('returns null for DOMESTIC (no clearance gate)', () => {
|
|
expect(clearanceSettingCode('DOMESTIC', 'CONTAINER', true)).toBeNull();
|
|
expect(clearanceSettingCode('DOMESTIC', 'BULK', false)).toBeNull();
|
|
});
|
|
});
|
|
|
|
describe('clearance.util — clearanceOutputSettingCode', () => {
|
|
it('returns a container output code only for customs container bookings', () => {
|
|
expect(clearanceOutputSettingCode('IMPORT', 'CONTAINER', true)).toBe(
|
|
'clearance_output_import_container',
|
|
);
|
|
expect(clearanceOutputSettingCode('EXPORT', 'CONTAINER', true)).toBe(
|
|
'clearance_output_export_container',
|
|
);
|
|
});
|
|
|
|
it('returns null without customs', () => {
|
|
expect(clearanceOutputSettingCode('IMPORT', 'CONTAINER', false)).toBeNull();
|
|
});
|
|
|
|
it('returns null for bulk (no container output set) and domestic', () => {
|
|
expect(clearanceOutputSettingCode('IMPORT', 'BULK', true)).toBeNull();
|
|
expect(clearanceOutputSettingCode('DOMESTIC', 'CONTAINER', true)).toBeNull();
|
|
});
|
|
});
|