-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathclient_test.go
More file actions
30 lines (26 loc) · 881 Bytes
/
client_test.go
File metadata and controls
30 lines (26 loc) · 881 Bytes
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
package ga4m
import (
"net/http"
"testing"
"time"
)
func TestNewClient(t *testing.T) {
measurementID := "G-XXXXXXXXXX"
apiSecret := "test_secret"
client := NewClient(measurementID, apiSecret)
if client.MeasurementID != measurementID {
t.Errorf("Expected MeasurementID %s, got %s", measurementID, client.MeasurementID)
}
if client.APISecret != apiSecret {
t.Errorf("Expected APISecret %s, got %s", apiSecret, client.APISecret)
}
if client.Endpoint != "https://www.google-analytics.com/mp/collect" {
t.Errorf("Unexpected Endpoint %s", client.Endpoint)
}
if client.DebugEndpoint != "https://www.google-analytics.com/debug/mp/collect" {
t.Errorf("Unexpected DebugEndpoint %s", client.DebugEndpoint)
}
if client.HTTPClient.(*http.Client).Timeout != 5*time.Second {
t.Errorf("Unexpected HTTPClient timeout %s", client.HTTPClient.(*http.Client).Timeout)
}
}