MCPcopy Create free account
hub / github.com/diillson/chatcli / TestGetRecentCommits

Function TestGetRecentCommits

operator/controllers/source_controller_test.go:298–319  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

296}
297
298func TestGetRecentCommits(t *testing.T) {
299 origin := newLocalGitRepo(t)
300 r := &SourceRepositoryReconciler{}
301
302 commits, err := r.getRecentCommits(context.Background(), origin)
303 if err != nil {
304 t.Fatalf("getRecentCommits: %v", err)
305 }
306 if len(commits) != 1 {
307 t.Fatalf("expected 1 commit, got %d", len(commits))
308 }
309 c := commits[0]
310 if len(c.SHA) != 40 {
311 t.Errorf("SHA length = %d, want 40", len(c.SHA))
312 }
313 if c.Message != "feat: initial commit" || c.Author != "test" {
314 t.Errorf("unexpected commit metadata: %+v", c)
315 }
316 if c.Timestamp.IsZero() {
317 t.Error("commit timestamp was not parsed")
318 }
319}
320
321func TestPullRepo(t *testing.T) {
322 r := &SourceRepositoryReconciler{}

Callers

nothing calls this directly

Calls 5

getRecentCommitsMethod · 0.95
newLocalGitRepoFunction · 0.85
ErrorfMethod · 0.80
IsZeroMethod · 0.80
ErrorMethod · 0.65

Tested by

no test coverage detected