summaryrefslogtreecommitdiff
path: root/internal/sync/git_operations_test.go
blob: 03ddb810247adc3a36a167b5d896da067627ac08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package sync

import "testing"

func TestGitCommand_SetsDir(t *testing.T) {
	cmd := gitCommand("/tmp/example-repo", "status")

	if cmd.Dir != "/tmp/example-repo" {
		t.Fatalf("expected command dir to be set, got %q", cmd.Dir)
	}
}

func TestGitCommand_LeavesDirEmptyForGlobalCommands(t *testing.T) {
	cmd := gitCommand("", "ls-remote", "--tags", "origin", "v1.0.0")

	if cmd.Dir != "" {
		t.Fatalf("expected empty dir for global command, got %q", cmd.Dir)
	}
}