github.com/ouraigua/jenkins-library@v0.0.0-20231028010029-fbeaf2f3aa9b/pkg/github/github_test.go (about)

     1  package github
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/assert"
     7  )
     8  
     9  func TestNewClientBuilder(t *testing.T) {
    10  	type args struct {
    11  		token   string
    12  		baseURL string
    13  	}
    14  	tests := []struct {
    15  		name string
    16  		args args
    17  		want *ClientBuilder
    18  	}{
    19  		{
    20  			name: "token and baseURL",
    21  			args: args{
    22  				token:   "test_token",
    23  				baseURL: "https://test.com/",
    24  			},
    25  			want: &ClientBuilder{
    26  				token:   "test_token",
    27  				baseURL: "https://test.com/",
    28  			},
    29  		},
    30  		{
    31  			name: "baseURL without prefix",
    32  			args: args{
    33  				token:   "test_token",
    34  				baseURL: "https://test.com",
    35  			},
    36  			want: &ClientBuilder{
    37  				token:   "test_token",
    38  				baseURL: "https://test.com/",
    39  			},
    40  		},
    41  	}
    42  	for _, tt := range tests {
    43  		t.Run(tt.name, func(t *testing.T) {
    44  			assert.Equalf(t, tt.want, NewClientBuilder(tt.args.token, tt.args.baseURL), "NewClientBuilder(%v, %v)", tt.args.token, tt.args.baseURL)
    45  		})
    46  	}
    47  }