@@ -532,19 +532,20 @@ func TestCleanMissingBaseBranch(t *testing.T) {
532532
533533func TestStartUnstagedChanges (t * testing.T ) {
534534 output , configuration := setup (t )
535- configuration .StartIncludeUncommittedChanges = false
535+ configuration .HandleUncommittedChanges = config . FailWithError
536536 createFile (t , "test.txt" , "contentIrrelevant" )
537537
538538 start (configuration )
539539
540540 assertOnBranch (t , "master" )
541541 assertNoMobSessionBranches (t , configuration , "mob-session" )
542542 assertOutputContains (t , output , "mob start --include-uncommitted-changes" )
543+ assertOutputContains (t , output , "mob start --discard-uncommitted-changes" )
543544}
544545
545546func TestStartIncludeUnstagedChanges (t * testing.T ) {
546547 _ , configuration := setup (t )
547- configuration .StartIncludeUncommittedChanges = true
548+ configuration .HandleUncommittedChanges = config . IncludeChanges
548549 createFile (t , "test.txt" , "contentIrrelevant" )
549550
550551 start (configuration )
@@ -553,9 +554,21 @@ func TestStartIncludeUnstagedChanges(t *testing.T) {
553554 assertMobSessionBranches (t , configuration , "mob-session" )
554555}
555556
557+ func TestStartDiscardUnstagedChanges (t * testing.T ) {
558+ _ , configuration := setup (t )
559+ configuration .HandleUncommittedChanges = config .DiscardChanges
560+ createFile (t , "test.txt" , "contentIrrelevant" )
561+
562+ start (configuration )
563+
564+ assertOnBranch (t , "mob-session" )
565+ assertMobSessionBranches (t , configuration , "mob-session" )
566+ assertCleanGitStatus (t )
567+ }
568+
556569func TestStartIncludeUnstagedChangesInNewWorkingDirectory (t * testing.T ) {
557570 output , configuration := setup (t )
558- configuration .StartIncludeUncommittedChanges = true
571+ configuration .HandleUncommittedChanges = config . IncludeChanges
559572 createDirectory (t , "subdirnew" )
560573 setWorkingDir (tempDir + "/local/subdirnew" )
561574 createFile (t , "test.txt" , "contentIrrelevant" )
@@ -587,7 +600,7 @@ func TestBranch(t *testing.T) {
587600
588601func TestStartIncludeUntrackedFiles (t * testing.T ) {
589602 _ , configuration := setup (t )
590- configuration .StartIncludeUncommittedChanges = true
603+ configuration .HandleUncommittedChanges = config . IncludeChanges
591604 createFile (t , "example.txt" , "contentIrrelevant" )
592605
593606 start (configuration )
@@ -597,7 +610,7 @@ func TestStartIncludeUntrackedFiles(t *testing.T) {
597610
598611func TestStartUntrackedFiles (t * testing.T ) {
599612 _ , configuration := setup (t )
600- configuration .StartIncludeUncommittedChanges = false
613+ configuration .HandleUncommittedChanges = config . FailWithError
601614 createFile (t , "example.txt" , "contentIrrelevant" )
602615
603616 start (configuration )
@@ -625,6 +638,7 @@ func TestStartOnUnpushedFeatureBranchWithUncommitedChanges(t *testing.T) {
625638
626639 assertOnBranch (t , "feature1" )
627640 assertOutputContains (t , output , "mob start --include-uncommitted-changes" )
641+ assertOutputContains (t , output , "mob start --discard-uncommitted-changes" )
628642}
629643
630644func TestStartCreateOnUnpushedFeatureBranch (t * testing.T ) {
@@ -660,6 +674,7 @@ func TestStartCreateOnUnpushedFeatureBranchWithUncommitedChanges(t *testing.T) {
660674
661675 assertOutputContains (t , output , "To start, including uncommitted changes and create the remote branch, use" )
662676 assertOutputContains (t , output , "mob start --create --include-uncommitted-changes" )
677+ assertOutputContains (t , output , "mob start --create --discard-uncommitted-changes" )
663678}
664679
665680func TestStartCreateIncludeUncommitedChangesOnUnpushedFeatureBranchWithUncommitedChanges (t * testing.T ) {
@@ -668,7 +683,7 @@ func TestStartCreateIncludeUncommitedChangesOnUnpushedFeatureBranchWithUncommite
668683 createFile (t , "file.txt" , "contentIrrelevant" )
669684
670685 configuration .StartCreate = true
671- configuration .StartIncludeUncommittedChanges = true
686+ configuration .HandleUncommittedChanges = config . IncludeChanges
672687 start (configuration )
673688
674689 assertOnBranch (t , "mob/feature1" )
@@ -680,7 +695,7 @@ func TestStartCreateIncludeUncommitedChangesOnUnpushedFeatureBranchWithUncommite
680695 createFile (t , "file.txt" , "contentIrrelevant" )
681696
682697 configuration .StartCreate = true
683- configuration .StartIncludeUncommittedChanges = true
698+ configuration .HandleUncommittedChanges = config . IncludeChanges
684699 configuration .WipBranchQualifier = "green"
685700 start (configuration )
686701
@@ -1521,6 +1536,7 @@ func TestStartBranchWithUncommitedChangesFixWithBranch(t *testing.T) {
15211536 runMob (t , tempDir + "/local" , "start" , "-b" , "green" )
15221537
15231538 assertOutputContains (t , output , "mob start --branch green --include-uncommitted-changes" )
1539+ assertOutputContains (t , output , "mob start --branch green --discard-uncommitted-changes" )
15241540 resetExit ()
15251541}
15261542
@@ -1534,6 +1550,7 @@ func TestStartBranchEnvWithUncommitedChangesFixWithoutBranch(t *testing.T) {
15341550 runMob (t , tempDir + "/local" , "start" )
15351551
15361552 assertOutputContains (t , output , "mob start --include-uncommitted-changes" )
1553+ assertOutputContains (t , output , "mob start --discard-uncommitted-changes" )
15371554 resetExit ()
15381555}
15391556
@@ -1548,6 +1565,7 @@ func TestStartCreateBranchWithUncommitedChangesFixWithBranch(t *testing.T) {
15481565 runMob (t , tempDir + "/local" , "start" , "--create" , "-b" , "green" )
15491566
15501567 assertOutputContains (t , output , "mob start --create --branch green --include-uncommitted-changes" )
1568+ assertOutputContains (t , output , "mob start --create --branch green --discard-uncommitted-changes" )
15511569 resetExit ()
15521570}
15531571
@@ -1563,6 +1581,7 @@ func TestStartCreateBranchEnvWithUncommitedChangesFixWithoutBranch(t *testing.T)
15631581
15641582 os .Unsetenv ("MOB_WIP_BRANCH_QUALIFIER" )
15651583 assertOutputContains (t , output , "mob start --create --include-uncommitted-changes" )
1584+ assertOutputContains (t , output , "mob start --create --discard-uncommitted-changes" )
15661585 resetExit ()
15671586}
15681587
0 commit comments