All files / src/components/Disputes/DisputeTable utils.ts

85.71% Statements 6/7
50% Branches 1/2
100% Functions 1/1
100% Lines 6/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 92x 42x   42x 42x 42x   42x  
export const getDisputeReasonCode = (str:string) => {
    Iif(!str) return {reason: "", code: ""}
 
    const parts = str.split(" - ");
    const code = parts.slice(0, 2).join(" "); // ex: "11.6.2 Authorization"
    const reason = parts.slice(2).join(" - "); // ex: "dispute condition"
    
    return {reason, code}
}