222483d194
CI / test (push) Successful in 10m26s
- Introduced new Delivery and Rider API documentation. - Added new models for RiderProfile, Shipment, ShipmentItem, ShipmentAssignment, ShipmentEvent, and ShipmentProof. - Developed controllers for admin and rider logistics, including shipment management and rider actions. - Created services for handling shipment creation, assignment, and state transitions. - Implemented validation schemas for shipment and rider operations. - Added new routes for admin and rider logistics, including tracking endpoints. - Established a state machine for shipment status transitions. - Created migration scripts for new database tables and relationships. - Added unit tests for shipment state transitions and validation security.
2 lines
702 B
JavaScript
2 lines
702 B
JavaScript
const state=require("../../app/services/logistics/shipmentState.service");describe("Phase 8 shipment state machine",()=>{test.each([["PENDING","READY_FOR_ASSIGNMENT"],["READY_FOR_ASSIGNMENT","ASSIGNED"],["ASSIGNED","PICKUP_PENDING"],["PICKUP_PENDING","PICKED_UP"],["PICKED_UP","IN_TRANSIT"],["IN_TRANSIT","OUT_FOR_DELIVERY"],["OUT_FOR_DELIVERY","DELIVERED"],["OUT_FOR_DELIVERY","DELIVERY_FAILED"],["DELIVERY_FAILED","RESCHEDULED"]])("allows %s -> %s",(a,b)=>expect(state.canTransition(a,b)).toBe(true));test.each([["DELIVERED","PICKED_UP"],["CANCELLED","DELIVERED"],["PENDING","DELIVERED"]])("rejects %s -> %s",(a,b)=>expect(()=>state.assertTransition(a,b)).toThrow(/Illegal shipment transition/));});
|