1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-08-09 09:22:48 +03:00

Add initial test for non-matching branch name

This commit is contained in:
Luke Swan
2024-07-10 00:47:22 +03:00
committed by Stefan Haller
parent b004b2e275
commit 07fe828f60
2 changed files with 39 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var CommitWithNonMatchingBranchName = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Commit with defined config commitPrefixes",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(testConfig *config.AppConfig) {
testConfig.UserConfig.Git.CommitPrefix = &config.CommitPrefixConfig{
Pattern: "^\\w+\\/(\\w+-\\w+).*",
Replace: "[$1]: ",
}
},
SetupRepo: func(shell *Shell) {
shell.NewBranch("branchnomatch")
shell.CreateFile("test-commit-prefix", "This is foo bar")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
IsEmpty()
t.Views().Files().
IsFocused().
PressPrimaryAction().
Press(keys.Files.CommitChanges)
t.ExpectPopup().CommitMessagePanel().
Title(Equals("Commit summary")).
/* EXPECTED:
InitialText(Equals(""))
ACTUAL: */
InitialText(Equals("branchnomatch"))
},
})

View File

@@ -80,6 +80,7 @@ var tests = []*components.IntegrationTest{
commit.CommitSwitchToEditor, commit.CommitSwitchToEditor,
commit.CommitWipWithPrefix, commit.CommitWipWithPrefix,
commit.CommitWithGlobalPrefix, commit.CommitWithGlobalPrefix,
commit.CommitWithNonMatchingBranchName,
commit.CommitWithPrefix, commit.CommitWithPrefix,
commit.CreateAmendCommit, commit.CreateAmendCommit,
commit.CreateTag, commit.CreateTag,