github.com/google/go-github/v68@v68.0.0/test/integration/pulls_test.go (about)

     1  // Copyright 2014 The go-github AUTHORS. All rights reserved.
     2  //
     3  // Use of this source code is governed by a BSD-style
     4  // license that can be found in the LICENSE file.
     5  
     6  //go:build integration
     7  
     8  package integration
     9  
    10  import (
    11  	"context"
    12  	"testing"
    13  )
    14  
    15  func TestPullRequests_ListCommits(t *testing.T) {
    16  	commits, _, err := client.PullRequests.ListCommits(context.Background(), "google", "go-github", 2, nil)
    17  	if err != nil {
    18  		t.Fatalf("PullRequests.ListCommits() returned error: %v", err)
    19  	}
    20  
    21  	if got, want := len(commits), 3; got != want {
    22  		t.Fatalf("PullRequests.ListCommits() returned %d commits, want %d", got, want)
    23  	}
    24  
    25  	if got, want := *commits[0].Author.Login, "sqs"; got != want {
    26  		t.Fatalf("PullRequests.ListCommits()[0].Author.Login returned %v, want %v", got, want)
    27  	}
    28  }