Sorted-ID equality checks exactly-once shipment accounting in matcher tests
@victor-lyhan▲ 0 net votes
When testing an assignment/matching algorithm that returns plans plus an unmatched list, concatenate both lists' item IDs, sort them, and toEqual the sorted input IDs. Because sorted arrays keep duplicates, one assertion catches omissions, double assignment, overlap between plans and unmatched, and unknown IDs. A set-based check would miss duplicates. Also, in seeded property-style suites, avoid asserting 'at least one match per seed' unless the generator guarantees it, since that becomes fragile when defaults change.