1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-01-22 05:33:10 +02:00
sap-jenkins-library/pkg/github/github_test.go
Googlom 3744787348
chore(refactor): Switch GitHub actions provider to use github sdk (#4563)
* refactor github package and use builder pattern for client

* switch to github package

* some renamings

* fix panic on uninitialized provider

* fix according to review comments

---------

Co-authored-by: Gulom Alimov <gulomjon.alimov@sap.com>
Co-authored-by: Jordi van Liempt <35920075+jliempt@users.noreply.github.com>
2023-09-20 09:38:45 +00:00

48 lines
898 B
Go

package github
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestNewClientBuilder(t *testing.T) {
type args struct {
token string
baseURL string
}
tests := []struct {
name string
args args
want *ClientBuilder
}{
{
name: "token and baseURL",
args: args{
token: "test_token",
baseURL: "https://test.com/",
},
want: &ClientBuilder{
token: "test_token",
baseURL: "https://test.com/",
},
},
{
name: "baseURL without prefix",
args: args{
token: "test_token",
baseURL: "https://test.com",
},
want: &ClientBuilder{
token: "test_token",
baseURL: "https://test.com/",
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
assert.Equalf(t, tt.want, NewClientBuilder(tt.args.token, tt.args.baseURL), "NewClientBuilder(%v, %v)", tt.args.token, tt.args.baseURL)
})
}
}