INNER CODE UNIT · Go

TestClassifyAheadBehindBoundary

Bharath-code/git-scope · internal/attention/attention_test.go:44

func TestClassifyAheadBehindBoundary(t *testing.T) {
	if Classify(status(func(s *model.RepoStatus) { s.Ahead = 0; s.Behind = 0 }), now) != Clean {
		t.Fatal("0/0 should be clean")
	}
	if Classify(status(func(s *model.RepoStatus) { s.Ahead = 1 }), now) != Action {
		t.Fatal("ahead=1 should be action")
	}
}

func TestStale(t *testing.T) {
	old := now.Add(-(StaleThreshold + time.Hour))
	fresh := now.Add(-time.Hour)
	tests := []struct {
		name string
		s    model.RepoStatus
		want bool
	}{
		{"dirty and old is stale", status(func(s *model.RepoStatus) { s.IsDirty = true; s.LastCommit = old }), true},

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…