This commit is contained in:
parent
9755abdfd3
commit
9ec56012c2
1 changed files with 26 additions and 0 deletions
26
internal/utils/path_test.go
Normal file
26
internal/utils/path_test.go
Normal file
|
@ -0,0 +1,26 @@
|
|||
package utils_test
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"git-repo-updater/internal/utils"
|
||||
)
|
||||
|
||||
func TestExpandPath(t *testing.T) {
|
||||
home, _ := os.UserHomeDir()
|
||||
|
||||
input := "~/Code/my-repo"
|
||||
expected := filepath.Join(home, "Code/my-repo")
|
||||
|
||||
result, err := utils.ExpandPath(input)
|
||||
|
||||
if err != nil {
|
||||
t.Errorf("ExpandPath(%q) returned error: %v", input, err)
|
||||
}
|
||||
|
||||
if result != expected {
|
||||
t.Errorf("ExpandPath(%q) = %q; want %q", input, result, expected)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue