From ae067fa2004790f677f8350b744b3ff34f365ff1 Mon Sep 17 00:00:00 2001 From: verse91 Date: Sun, 10 May 2026 02:13:07 +0700 Subject: [PATCH] fix(test): add user email and name to support ci/cd --- tests/dev/git_test.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/dev/git_test.go b/tests/dev/git_test.go index 64147ce..2b01912 100644 --- a/tests/dev/git_test.go +++ b/tests/dev/git_test.go @@ -22,10 +22,14 @@ func TestGitSuggestions(t *testing.T) { ctx := context.Background() // Initialize git repo _ = exec.CommandContext(ctx, "git", "init").Run() + + _ = exec.CommandContext(ctx, "git", "config", "user.email", "iris-test@example.com").Run() // this is for ci/cd + _ = exec.CommandContext(ctx, "git", "config", "user.name", "Iris Test").Run() // this is for ci/cd + _ = os.WriteFile(filepath.Join(tmp, "file.go"), []byte("package main"), 0644) _ = exec.CommandContext(ctx, "git", "add", ".").Run() _ = exec.CommandContext(ctx, "git", "commit", "-m", "initial").Run() - + // Create branches _ = exec.CommandContext(ctx, "git", "branch", "feature/login").Run() _ = exec.CommandContext(ctx, "git", "branch", "dev").Run() @@ -87,7 +91,7 @@ func TestGitSuggestions(t *testing.T) { t.Run("git reset options", func(t *testing.T) { // git reset --soft origin/main -> should be accepted (just testing lookup doesn't crash) _ = core.Lookup("git reset --soft origin/main ") - + // git reset HEAD -> show files res := core.Lookup("git reset HEAD ") found := false @@ -145,7 +149,7 @@ func TestGitSuggestions(t *testing.T) { // find current branch out, _ := exec.CommandContext(ctx, "git", "rev-parse", "--abbrev-ref", "HEAD").Output() current := strings.TrimSpace(string(out)) - + res := core.Lookup("git checkout ") for _, r := range res { if strings.Contains(r.Cmd, current) && !strings.Contains(r.Cmd, "remotes/") {