summaryrefslogtreecommitdiffstats
path: root/pkg/app/app_test.go
blob: c2cd0c8c0ea721caf4ff6064bdff79c62c5e40cc (plain)
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
35
36
37
38
39
40
41
42
43
44
45
package app

import (
	"testing"

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

func TestIsGitVersionValid(t *testing.T) {
	type scenario struct {
		versionStr     string
		expectedResult bool
	}

	scenarios := []scenario{
		{
			"",
			false,
		},
		{
			"git version 1.9.0",
			false,
		},
		{
			"git version 1.9.0 (Apple Git-128)",
			false,
		},
		{
			"git version 2.4.0",
			true,
		},
		{
			"git version 2.24.3 (Apple Git-128)",
			true,
		},
	}

	for _, s := range scenarios {
		s := s
		t.Run(s.versionStr, func(t *testing.T) {
			result := isGitVersionValid(s.versionStr)
			assert.Equal(t, result, s.expectedResult)
		})
	}
}