Skip to content

Latest commit

 

History

History
15 lines (12 loc) · 1.13 KB

File metadata and controls

15 lines (12 loc) · 1.13 KB

TODO

Invoice state machine exhaustive transition matrix tests

  • Read current invoice.state.test.js and understand existing coverage gaps.
  • Implement a data-driven Cartesian matrix test for every (fromState, targetState) pair across INVOICE_STATES.
    • Assert isTransitionAllowed outcome matches VALID_TRANSITIONS, including silent-jump prevention (pending → linked_escrow) and self transitions.
    • Assert validateTransition returns exact error codes: INVALID_TRANSITION, TERMINAL_STATE, ALREADY_IN_TARGET_STATE.
    • Ensure terminal states reject all outgoing transitions.
  • Add executeTransition assertions:
    • For each allowed transition, ensure it writes an audit log entry (action=STATE_TRANSITION) with correct before/after states and metadata reason/transitionType.
    • For each disallowed transition, ensure executeTransition throws an error with correct error.code.
  • Add executeTransition/canLinkToEscrow coverage for business rule: must be approved to link.
  • Run test suite and confirm invoiceStateMachine.js hits 100% branch coverage (cannot be executed here due to missing npm in terminal).