-
Notifications
You must be signed in to change notification settings - Fork 8
/
github_test.go
44 lines (40 loc) · 944 Bytes
/
github_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package resource_test
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
resource "github.com/telia-oss/github-pr-resource"
)
func TestNewGithubClient(t *testing.T) {
tests := []struct {
description string
source resource.Source
expect struct {
owner string
repository string
}
}{
{
description: "owner & repo set properly",
source: resource.Source{
Repository: "itsdalmo/test-repository",
AccessToken: "oauthtoken",
},
expect: struct {
owner string
repository string
}{
owner: "itsdalmo",
repository: "test-repository",
},
},
}
for _, tc := range tests {
t.Run(tc.description, func(t *testing.T) {
client, err := resource.NewGithubClient(&tc.source)
require.NoError(t, err)
assert.Equal(t, tc.expect.owner, client.Owner)
assert.Equal(t, tc.expect.repository, client.Repository)
})
}
}