Lightweight and easily self-hostable Git forge. git.poy.ooo
git-forge selfhosting homebrew
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930package git
import ( "farga/lib" "path/filepath" "strings" "testing"
"github.com/google/uuid")
// path should be absolute and end with a trailing slash.func TestGitRepoPath(t *testing.T) { userID := uuid.Must(uuid.NewV7()) repoID := uuid.Must(uuid.NewV7())
base, err := filepath.Abs(lib.GitReposDir) if err != nil { t.Errorf("Something went wrong with your GitReposDir.") }
want := filepath.Join(base, userID.String(), repoID.String()) + "/" suffix := userID.String() + "/" + repoID.String() + "/" path := RepoPath(&userID, &repoID)
if path != want || !strings.HasSuffix(path, suffix) { t.Errorf(`RepoPath(&userID, &repoID) = %s FAILED. IT DID NOT WORK FINE. IDIOT. FIX IT. It should match for %s`, path, want) }}