@@ -254,7 +254,12 @@ describe("vcsActionState", () => {
254254 try {
255255 for ( const enabled of [ false , true ] ) {
256256 setMergeRequestTerms ( enabled ) ;
257- for ( const label of [ "Preparing PR..." , "Generating PR content..." ] ) {
257+ for ( const label of [
258+ "Preparing PR..." ,
259+ "Generating PR content..." ,
260+ "Preparing MR..." ,
261+ "Generating MR content..." ,
262+ ] ) {
258263 const prEvent = progress ( {
259264 ...event ,
260265 actionId : transportActionId ,
@@ -263,63 +268,73 @@ describe("vcsActionState", () => {
263268 } ) ;
264269 expect (
265270 normalizeVcsActionProgressEvent ( target , transportActionId , actionId , prEvent ) ,
266- ) . toEqual ( { ...prEvent , actionId, label : enabled ? label . replace ( "PR" , "MR" ) : label } ) ;
271+ ) . toEqual ( {
272+ ...prEvent ,
273+ actionId,
274+ label : label . replace ( / P R | M R / gu, enabled ? "MR" : "PR" ) ,
275+ } ) ;
267276 }
268- const url = "https://git.example.test/PR/pull/12" ;
269- const terminalResult : GitRunStackedActionResult = {
270- ...result ,
271- commit : { ...result . commit , subject : "Fix PR rendering" } ,
272- pr : { status : "opened_existing" , url, title : "Fix PR rendering" } ,
273- toast : {
274- title : "Opened PR #12" ,
275- description : "Fix PR rendering" ,
276- cta : { kind : "open_pr" , label : "View PR" , url } ,
277- } ,
278- } ;
279- expect (
280- normalizeVcsActionProgressEvent ( target , transportActionId , actionId , {
281- cwd,
282- action,
283- actionId : transportActionId ,
284- kind : "action_finished" ,
285- result : terminalResult ,
286- } ) ,
287- ) . toEqual ( {
288- cwd,
289- action,
290- actionId,
291- kind : "action_finished" ,
292- result : {
293- ...terminalResult ,
277+ for ( const sourceTerm of [ "PR" , "MR" ] ) {
278+ const url = `https://git.example.test/${ sourceTerm } /pull/12` ;
279+ const terminalResult : GitRunStackedActionResult = {
280+ ...result ,
281+ commit : { ...result . commit , subject : `Fix ${ sourceTerm } rendering` } ,
282+ pr : { status : "opened_existing" , url, title : `Fix ${ sourceTerm } rendering` } ,
294283 toast : {
295- ... terminalResult . toast ,
296- title : enabled ? "Opened MR #12" : "Opened PR #12" ,
297- cta : { kind : "open_pr" , label : enabled ? " View MR" : "View PR" , url } ,
284+ title : `Opened ${ sourceTerm } #12` ,
285+ description : `Fix ${ sourceTerm } rendering` ,
286+ cta : { kind : "open_pr" , label : ` View ${ sourceTerm } ` , url } ,
298287 } ,
299- } ,
300- } ) ;
301- expect (
302- normalizeVcsActionProgressEvent ( target , transportActionId , actionId , {
288+ } ;
289+ expect (
290+ normalizeVcsActionProgressEvent ( target , transportActionId , actionId , {
291+ cwd,
292+ action,
293+ actionId : transportActionId ,
294+ kind : "action_finished" ,
295+ result : terminalResult ,
296+ } ) ,
297+ ) . toEqual ( {
303298 cwd,
304299 action,
305- actionId : transportActionId ,
300+ actionId,
306301 kind : "action_finished" ,
307302 result : {
308- ...result ,
303+ ...terminalResult ,
309304 toast : {
310- title : "Pushed to feature/PR" ,
311- cta : { kind : "run_action" , label : "Create PR" , action : { kind : "create_pr" } } ,
305+ ...terminalResult . toast ,
306+ title : enabled ? "Opened MR #12" : "Opened PR #12" ,
307+ cta : { kind : "open_pr" , label : enabled ? "View MR" : "View PR" , url } ,
312308 } ,
313309 } ,
314- } ) ,
315- ) . toMatchObject ( {
316- result : {
317- toast : {
318- title : "Pushed to feature/PR" ,
319- cta : { label : enabled ? "Create MR" : "Create PR" } ,
310+ } ) ;
311+ expect (
312+ normalizeVcsActionProgressEvent ( target , transportActionId , actionId , {
313+ cwd,
314+ action,
315+ actionId : transportActionId ,
316+ kind : "action_finished" ,
317+ result : {
318+ ...result ,
319+ toast : {
320+ title : `Pushed to feature/${ sourceTerm } ` ,
321+ cta : {
322+ kind : "run_action" ,
323+ label : `Create ${ sourceTerm } ` ,
324+ action : { kind : "create_pr" } ,
325+ } ,
326+ } ,
327+ } ,
328+ } ) ,
329+ ) . toMatchObject ( {
330+ result : {
331+ toast : {
332+ title : `Pushed to feature/${ sourceTerm } ` ,
333+ cta : { label : enabled ? "Create MR" : "Create PR" } ,
334+ } ,
320335 } ,
321- } ,
322- } ) ;
336+ } ) ;
337+ }
323338 }
324339 } finally {
325340 setMergeRequestTerms ( false ) ;
0 commit comments