package git

import (
	"context"
	"path/filepath"
	"testing"
	"time"

	"github.com/stretchr/testify/require"
)

func TestFetch_Success(t *testing.T) {
	t.Parallel()
	gitAvailable(t)
	bare := makeBareRepo(t)
	r := newTestRunner(t)
	dst := filepath.Join(t.TempDir(), "wc")
	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
	defer cancel()
	require.NoError(t, r.Clone(ctx, dst, bare, "main", nil))
	require.NoError(t, r.Fetch(ctx, dst, nil))
}
