11import type { VcsStatusResult } from "@t3tools/contracts" ;
2- import {
3- buildMenuItems as buildMobileMenuItems ,
4- getGitActionDisabledReason ,
5- } from "@t3tools/client-runtime/state/vcs" ;
62import { assert , describe , it } from "vite-plus/test" ;
73import {
84 buildGitActionProgressStages ,
@@ -369,7 +365,7 @@ describe("when: source control provider uses merge requests", () => {
369365} ) ;
370366
371367describe ( "when: ref is clean, up to date, and has no open PR" , ( ) => {
372- it ( "enables create PR when synced with upstream but ahead of default, including dirty worktrees " , ( ) => {
368+ it ( "enables create PR when synced with upstream but ahead of default, even with local changes " , ( ) => {
373369 const syncedFeature = status ( {
374370 aheadCount : 0 ,
375371 behindCount : 0 ,
@@ -389,29 +385,9 @@ describe("when: ref is clean, up to date, and has no open PR", () => {
389385 assert . equal ( items . find ( ( item ) => item . id === "pr" ) ?. disabled , false ) ;
390386
391387 const dirtyFeature = { ...syncedFeature , hasWorkingTreeChanges : true } ;
392- assert . equal ( buildMenuItems ( dirtyFeature , false ) [ 2 ] ?. disabled , false ) ;
393- const mobileItem = buildMobileMenuItems ( dirtyFeature , false ) [ 2 ] ! ;
394- assert . isFalse ( mobileItem . disabled ) ;
395- assert . isNull (
396- getGitActionDisabledReason ( {
397- item : mobileItem ,
398- gitStatus : dirtyFeature ,
399- isBusy : false ,
400- hasOriginRemote : true ,
401- } ) ,
402- ) ;
403- assert . equal ( buildMobileMenuItems ( dirtyFeature , true ) [ 2 ] ?. disabled , true ) ;
404- const behindFeature = { ...dirtyFeature , behindCount : 1 } ;
405- const behindItem = buildMobileMenuItems ( behindFeature , false ) [ 2 ] ! ;
406- assert . isTrue ( behindItem . disabled ) ;
407388 assert . equal (
408- getGitActionDisabledReason ( {
409- item : behindItem ,
410- gitStatus : behindFeature ,
411- isBusy : false ,
412- hasOriginRemote : true ,
413- } ) ,
414- "Branch is behind upstream. Pull/rebase before creating a PR." ,
389+ buildMenuItems ( dirtyFeature , false ) . find ( ( item ) => item . id === "pr" ) ?. disabled ,
390+ false ,
415391 ) ;
416392 } ) ;
417393
0 commit comments