Debian Codegraph @

internal/app/builder_test.go

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
1 package app
2
3 import (
4 "os"
5 "testing"
6
7 "github.com/isacikgoz/gitbatch/internal/git"
8 "github.com/stretchr/testify/require"
9 )
10
11 func TestOverrideConfig(t *testing.T) {
12 config1 := &Config{
13 Directories: []string{},
14 LogLevel: "info",
15 Depth: 1,
16 QuickMode: false,
17 Mode: "fetch",
18 }
19 config2 := &Config{
20 Directories: []string{string(os.PathSeparator) + "tmp"},
21 LogLevel: "error",
22 Depth: 1,
23 QuickMode: true,
24 Mode: "pull",
25 }
26
27 var tests = []struct {
28 inp1 *Config
29 inp2 *Config
30 expected *Config
31 }{
32 {config1, config2, config1},
33 }
34 for _, test := range tests {
35 output := overrideConfig(test.inp1, test.inp2)
36 require.Equal(t, test.expected, output)
37 require.Equal(t, test.inp2.Mode, output.Mode)
38 }
39 }
40
41 func TestExecQuickMode(t *testing.T) {
•42 // Test requires internet access
43 t.Skip()
44 th := git.InitTestRepositoryFromLocal(t)
45 defer th.CleanUp(t)
46
47 var tests = []struct {
48 inp1 []string
49 }{
50 {[]string{th.BasicRepoPath()}},
51 }
52 a := App{
53 Config: &Config{
54 Mode: "fetch",
55 },
56 }
57 for _, test := range tests {
58 err := a.execQuickMode(test.inp1)
59 require.NoError(t, err)
60 }
61 }