This repository was archived by the owner on Mar 10, 2021. It is now read-only.
forked from harbur/captain
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgit_test.go
More file actions
44 lines (36 loc) · 1.28 KB
/
git_test.go
File metadata and controls
44 lines (36 loc) · 1.28 KB
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
package captain // import "github.com/harbur/captain"
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestGitGetRevision(t *testing.T) {
rev, err := getRevision(false)
assert.NoError(t, err)
assert.Equal(t, 7, len(rev), "Git revision should have length 7 chars")
}
func TestGitGetRevisionFullSha(t *testing.T) {
rev, err := getRevision(true)
assert.NoError(t, err)
assert.Equal(t, 40, len(rev), "Git revision should have a length of 40 chars")
}
// TODO Fails because it assumes current branch is master
func TestGitGetBranch(t *testing.T) {
branches, err := getBranches(false)
assert.NoError(t, err)
assert.NotEmpty(t, branches)
// assert.Equal(t, []string{"master"}, getBranches(false), "Git branch should be master")
}
// TODO Fails because it assumes current branch is master
func TestGitGetBranchAllBranches(t *testing.T) {
branches, err := getBranches(true)
assert.NoError(t, err)
assert.NotEmpty(t, branches)
// assert.Equal(t, []string{"master"}, getBranches(true), "Git branch should be master")
}
// TODO Fails because vendors/ is not git-ignored.
func TestGitIsDirty(t *testing.T) {
// assert.Equal(t, false, isDirty(), "Git should not have local changes")
}
func TestGitIsGit(t *testing.T) {
assert.Equal(t, true, isGit(), "There should be a git repository")
}