github.com/JarrahG/buffalocli@v0.0.0-20230801092127-b85bfd5d395a/internal/genny/vcs/vcs_test.go (about) 1 package vcs 2 3 import ( 4 "strings" 5 "testing" 6 7 "github.com/gobuffalo/genny/v2/gentest" 8 "github.com/stretchr/testify/require" 9 ) 10 11 func Test_New_Bzr(t *testing.T) { 12 r := require.New(t) 13 14 g, err := New(&Options{ 15 Provider: "bzr", 16 }) 17 r.NoError(err) 18 19 run := gentest.NewRunner() 20 r.NoError(run.With(g)) 21 r.NoError(run.Run()) 22 23 res := run.Results() 24 r.Len(res.Files, 1) 25 26 f := res.Files[0] 27 r.Equal(".bzrignore", f.Name()) 28 29 cmds := []string{ 30 "bzr init", 31 "bzr add . -q", 32 "bzr commit -q -m Initial Commit", 33 } 34 35 r.Len(res.Commands, len(cmds)) 36 for i, c := range res.Commands { 37 r.Equal(cmds[i], strings.Join(c.Args, " ")) 38 } 39 } 40 41 func Test_New_Git(t *testing.T) { 42 r := require.New(t) 43 44 g, err := New(&Options{ 45 Provider: "git", 46 }) 47 r.NoError(err) 48 49 run := gentest.NewRunner() 50 r.NoError(run.With(g)) 51 r.NoError(run.Run()) 52 53 res := run.Results() 54 r.Len(res.Files, 1) 55 56 f := res.Files[0] 57 r.Equal(".gitignore", f.Name()) 58 59 cmds := []string{ 60 "git init", 61 "git add .", 62 "git commit -q -m Initial Commit", 63 } 64 65 r.Len(res.Commands, len(cmds)) 66 for i, c := range res.Commands { 67 r.Equal(cmds[i], strings.Join(c.Args, " ")) 68 } 69 }