INNER CODE UNIT · Go

old

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

	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},
		{"dirty and fresh not stale", status(func(s *model.RepoStatus) { s.IsDirty = true; s.LastCommit = fresh }), false},
		{"clean and old not stale", status(func(s *model.RepoStatus) { s.LastCommit = old }), false},
		{"exactly at threshold not stale", status(func(s *model.RepoStatus) {
			s.IsDirty = true
			s.LastCommit = now.Add(-StaleThreshold)
		}), false},
	}
	for _, tc := range tests {
		t.Run(tc.name, func(t *testing.T) {
			if got := Stale(tc.s, now); got != tc.want {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…