forked from gptscript-ai/gptscript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgit_test.go
34 lines (29 loc) · 809 Bytes
/
git_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package git
import (
"context"
"os"
"path/filepath"
"testing"
"github.com/adrg/xdg"
"github.com/samber/lo"
"github.com/stretchr/testify/require"
)
var (
testCacheHome = lo.Must(xdg.CacheFile("gptscript-test-cache/repo"))
testCommit = "f9d0ca6559d0b7c78da7f413fc4faf87ae9b8919"
)
func TestFetch(t *testing.T) {
err := fetch(context.Background(), testCacheHome,
"https://github.com/gptscript-ai/dalle-image-generation.git",
testCommit)
require.NoError(t, err)
}
func TestCheckout(t *testing.T) {
commitDir := filepath.Join(testCacheHome, "commits", testCommit)
err := os.RemoveAll(commitDir)
require.NoError(t, err)
err = Checkout(context.Background(), testCacheHome,
"https://github.com/gptscript-ai/dalle-image-generation.git",
testCommit, commitDir)
require.NoError(t, err)
}