Skip to content

Commit 7d9f96a

Browse files
Copilotbzimmer
andauthored
test: increase coverage for httpclient, rwgps, strava, zwift, cyclinganalytics
Agent-Logs-Url: https://github.com/bzimmer/activity/sessions/2ad0d420-ca26-4998-81fd-041ad6a00431 Co-authored-by: bzimmer <12852+bzimmer@users.noreply.github.com>
1 parent 747ab10 commit 7d9f96a

7 files changed

Lines changed: 969 additions & 2 deletions

File tree

cyclinganalytics/cyclinganalytics_test.go

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,55 @@ func TestWith(t *testing.T) {
2727
a.NoError(err)
2828
a.NotNil(client)
2929
}
30+
31+
func TestWithTransport(t *testing.T) {
32+
t.Parallel()
33+
a := assert.New(t)
34+
35+
tests := []struct {
36+
name string
37+
transport http.RoundTripper
38+
wantErr bool
39+
}{
40+
{
41+
name: "valid transport",
42+
transport: http.DefaultTransport,
43+
wantErr: false,
44+
},
45+
{
46+
name: "nil transport returns error",
47+
transport: nil,
48+
wantErr: true,
49+
},
50+
}
51+
52+
for _, tt := range tests {
53+
tt := tt
54+
t.Run(tt.name, func(t *testing.T) {
55+
t.Parallel()
56+
client, err := cyclinganalytics.NewClient(cyclinganalytics.WithTransport(tt.transport))
57+
if tt.wantErr {
58+
a.Error(err)
59+
a.Nil(client)
60+
} else {
61+
a.NoError(err)
62+
a.NotNil(client)
63+
}
64+
})
65+
}
66+
}
67+
68+
func TestStreamSets(t *testing.T) {
69+
t.Parallel()
70+
a := assert.New(t)
71+
72+
client, err := cyclinganalytics.NewClient()
73+
a.NoError(err)
74+
a.NotNil(client)
75+
76+
sets := client.Rides.StreamSets()
77+
a.NotEmpty(sets)
78+
a.Contains(sets, "power")
79+
a.Contains(sets, "heartrate")
80+
a.Contains(sets, "distance")
81+
}

0 commit comments

Comments
 (0)