-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathclient_test.go
45 lines (39 loc) · 954 Bytes
/
client_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
45
// This file was auto-generated by Fern from our API Definition.
package client
import (
option "github.com/seamapi/go/option"
assert "github.com/stretchr/testify/assert"
http "net/http"
testing "testing"
time "time"
)
func TestNewClient(t *testing.T) {
t.Run("default", func(t *testing.T) {
c := NewClient()
assert.Empty(t, c.baseURL)
})
t.Run("base url", func(t *testing.T) {
c := NewClient(
option.WithBaseURL("test.co"),
)
assert.Equal(t, "test.co", c.baseURL)
})
t.Run("http client", func(t *testing.T) {
httpClient := &http.Client{
Timeout: 5 * time.Second,
}
c := NewClient(
option.WithHTTPClient(httpClient),
)
assert.Empty(t, c.baseURL)
})
t.Run("http header", func(t *testing.T) {
header := make(http.Header)
header.Set("X-API-Tenancy", "test")
c := NewClient(
option.WithHTTPHeader(header),
)
assert.Empty(t, c.baseURL)
assert.Equal(t, "test", c.header.Get("X-API-Tenancy"))
})
}