INNER CODE UNIT · Go
status
Bharath-code/git-scope · internal/attention/attention_test.go:12
func status(mut func(*model.RepoStatus)) model.RepoStatus {
s := model.RepoStatus{LastCommit: now}
if mut != nil {
mut(&s)
}
return s
}
func TestClassify(t *testing.T) {
tests := []struct {
name string
s model.RepoStatus
want Tier
}{
{"empty is clean", status(nil), Clean},
{"ahead is action", status(func(s *model.RepoStatus) { s.Ahead = 1 }), Action},
{"behind is action", status(func(s *model.RepoStatus) { s.Behind = 1 }), Action},
{"diverged is action", status(func(s *model.RepoStatus) { s.Ahead = 2; s.Behind = 3 }), Action},