MCPcopy Create free account
hub / github.com/cli/cli / TestClientCommits

Function TestClientCommits

git/client_test.go:499–665  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

497}
498
499func TestClientCommits(t *testing.T) {
500 tests := []struct {
501 name string
502 testData stubbedCommitsCommandData
503 wantCmdArgs string
504 wantCommits []*Commit
505 wantErrorMsg string
506 }{
507 {
508 name: "single commit no body",
509 testData: stubbedCommitsCommandData{
510 Commits: []stubbedCommit{
511 {
512 Sha: "6a6872b918c601a0e730710ad8473938a7516d30",
513 Title: "testing testability test",
514 Body: "",
515 },
516 },
517 },
518 wantCmdArgs: `path/to/git -c log.ShowSignature=false log --pretty=format:%H%x00%s%x00%b%x00 --cherry SHA1...SHA2`,
519 wantCommits: []*Commit{{
520 Sha: "6a6872b918c601a0e730710ad8473938a7516d30",
521 Title: "testing testability test",
522 }},
523 },
524 {
525 name: "single commit with body",
526 testData: stubbedCommitsCommandData{
527 Commits: []stubbedCommit{
528 {
529 Sha: "6a6872b918c601a0e730710ad8473938a7516d30",
530 Title: "testing testability test",
531 Body: "This is the body",
532 },
533 },
534 },
535 wantCmdArgs: `path/to/git -c log.ShowSignature=false log --pretty=format:%H%x00%s%x00%b%x00 --cherry SHA1...SHA2`,
536 wantCommits: []*Commit{{
537 Sha: "6a6872b918c601a0e730710ad8473938a7516d30",
538 Title: "testing testability test",
539 Body: "This is the body",
540 }},
541 },
542 {
543 name: "multiple commits with bodies",
544 testData: stubbedCommitsCommandData{
545 Commits: []stubbedCommit{
546 {
547 Sha: "6a6872b918c601a0e730710ad8473938a7516d30",
548 Title: "testing testability test",
549 Body: "This is the body",
550 },
551 {
552 Sha: "7a6872b918c601a0e730710ad8473938a7516d31",
553 Title: "testing testability test 2",
554 Body: "This is the body 2",
555 },
556 },

Callers

nothing calls this directly

Calls 5

CommitsMethod · 0.95
EqualMethod · 0.80
JoinMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected