@@ -124,6 +124,26 @@ describe("loopover-mcp pr-outcomes CLI (#6747)", () => {
124124 } ) ;
125125 expect ( badLimit . status ) . toBe ( 1 ) ;
126126 expect ( `${ badLimit . stdout } ${ badLimit . stderr } ` ) . toMatch ( / i n t e g e r b e t w e e n 1 a n d 1 0 0 / ) ;
127+
128+ const bareLimit = runExpectingFailure ( [ "pr-outcomes" , "--login" , "JSONbored" , "--limit" , "101" ] , {
129+ LOOPOVER_API_URL : apiUrl ,
130+ LOOPOVER_TOKEN : "session-token" ,
131+ } ) ;
132+ expect ( bareLimit . status ) . toBe ( 1 ) ;
133+ } ) ;
134+
135+ it ( "falls back when the API omits summary and prints null pull numbers / empty attributions" , async ( ) => {
136+ await closeFixtureServer ( ) ;
137+ const sparseUrl = await startFixtureServer ( {
138+ prOutcomes : {
139+ summary : " " ,
140+ outcomes : [ { repoFullName : "a/b" , pullNumber : null , outcome : "merged" , attribution : "" , deeplink : "https://x" , recordedAt : "t" } ] ,
141+ } ,
142+ } ) ;
143+ const env = { LOOPOVER_API_URL : sparseUrl , LOOPOVER_TOKEN : "session-token" } ;
144+ const plain = await runAsync ( [ "pr-outcomes" , "--login" , "JSONbored" ] , env ) ;
145+ expect ( plain ) . toContain ( "LoopOver post-merge outcomes for JSONbored." ) ;
146+ expect ( plain ) . toContain ( "a/b#? [merged]" ) ;
127147 } ) ;
128148
129149 it ( "strips ANSI escapes from API-chosen text on the plain-text path but not from --json" , async ( ) => {
@@ -142,6 +162,15 @@ describe("loopover-mcp pr-outcomes CLI (#6747)", () => {
142162 expect ( JSON . parse ( asJson ) . summary ) . toBe ( "\u001b[31mFAKE PASS\u001b[0m" ) ;
143163 } ) ;
144164
165+ it ( "ignores a bare --limit flag (no value) and still returns outcomes" , async ( ) => {
166+ const out = await runAsync ( [ "pr-outcomes" , "--login" , "JSONbored" , "--limit" , "--json" ] , {
167+ LOOPOVER_API_URL : apiUrl ,
168+ LOOPOVER_TOKEN : "session-token" ,
169+ } ) ;
170+ expect ( JSON . parse ( out ) ) . toEqual ( prOutcomesFixture ( ) ) ;
171+ expect ( capturedRequests . at ( - 1 ) ?. url ) . not . toContain ( "limit=" ) ;
172+ } ) ;
173+
145174 it ( "documents itself in --help and in the shell-completion command list" , ( ) => {
146175 expect ( run ( [ "--help" ] ) ) . toContain ( "loopover-mcp pr-outcomes --login <github-login> [--limit N] [--json]" ) ;
147176 expect ( run ( [ "pr-outcomes" , "--help" ] ) ) . toContain ( "Mirrors the loopover_pr_outcome MCP tool" ) ;
0 commit comments