(opts: {
headBranch?: string;
primaryBranch?: string;
ahead?: number;
behind?: number;
dirty?: number;
outAdd?: number;
outDel?: number;
inAdd?: number;
inDel?: number;
})
| 7 | |
| 8 | // Helper to build script output matching the bash echo format |
| 9 | function buildOutput(opts: { |
| 10 | headBranch?: string; |
| 11 | primaryBranch?: string; |
| 12 | ahead?: number; |
| 13 | behind?: number; |
| 14 | dirty?: number; |
| 15 | outAdd?: number; |
| 16 | outDel?: number; |
| 17 | inAdd?: number; |
| 18 | inDel?: number; |
| 19 | }): string { |
| 20 | const { |
| 21 | headBranch = "feature-x", |
| 22 | primaryBranch = "main", |
| 23 | ahead = 0, |
| 24 | behind = 0, |
| 25 | dirty = 0, |
| 26 | outAdd = 0, |
| 27 | outDel = 0, |
| 28 | inAdd = 0, |
| 29 | inDel = 0, |
| 30 | } = opts; |
| 31 | return [ |
| 32 | "---HEAD_BRANCH---", |
| 33 | headBranch, |
| 34 | "---PRIMARY---", |
| 35 | primaryBranch, |
| 36 | "---AHEAD_BEHIND---", |
| 37 | `${ahead}\t${behind}`, |
| 38 | "---DIRTY---", |
| 39 | `${dirty}`, |
| 40 | "---LINE_DELTA---", |
| 41 | `${outAdd} ${outDel} ${inAdd} ${inDel}`, |
| 42 | ].join("\n"); |
| 43 | } |
| 44 | |
| 45 | describe("parseGitStatusScriptOutput", () => { |
| 46 | it("parses headBranch from output", () => { |
no outgoing calls
no test coverage detected