| 1 | package command |
| 2 | |
| 3 | import ( |
| 4 | "testing" |
| 5 | |
| 6 | "github.com/isacikgoz/gitbatch/internal/git" |
| 7 | "github.com/stretchr/testify/require" |
| 8 | ) |
| 9 | |
| 10 | func TestCheckout(t *testing.T) { |
| 11 | opts1 := &CheckoutOptions{ |
| 12 | TargetRef: "master", |
| 13 | CreateIfAbsent: false, |
| 14 | CommandMode: ModeLegacy, |
| 15 | } |
| 16 | opts2 := &CheckoutOptions{ |
| 17 | TargetRef: "develop", |
| 18 | CreateIfAbsent: true, |
| 19 | CommandMode: ModeLegacy, |
| 20 | } |
| 21 | |
| 22 | th := git.InitTestRepositoryFromLocal(t) |
| 23 | defer th.CleanUp(t) |
| 24 | |
| 25 | var tests = []struct { |
| 26 | inp1 *git.Repository |
| 27 | inp2 *CheckoutOptions |
| 28 | }{ |
| 29 | {th.Repository, opts1}, |
| 30 | {th.Repository, opts2}, |
| 31 | } |
| 32 | for _, test := range tests { |
| 33 | err := Checkout(test.inp1, test.inp2) |
| 34 | require.NoError(t, err) |
| 35 | } |
| 36 | } |