Skip to content
This repository was archived by the owner on Oct 12, 2023. It is now read-only.

Commit 994ba8f

Browse files
authored
Merge pull request #9 from sonmaximum/main
Fix bug in workout and in tests
2 parents 5d9cc83 + a9c55df commit 994ba8f

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

tag_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func testTags(t *testing.T, start_date, end_date, next_token, expectedURL, mock
8484
got, _, err := client.Tags(context.Background(), start_date, end_date, next_token)
8585
assert.NoError(t, err, "should not return an error")
8686

87-
want := &Sessions{}
87+
want := &Tags{}
8888
json.Unmarshal([]byte(mock), want) //nolint:errcheck
8989

9090
assert.ObjectsAreEqual(want, got)

workout.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ type Workout struct {
2121

2222
// Workouts represents the workout data within a given timeframe.
2323
type Workouts struct {
24-
Data []Tag `json:"data"`
25-
NextToken string `json:"next_token"`
24+
Data []Workout `json:"data"`
25+
NextToken string `json:"next_token"`
2626
}
2727

2828
// Workout gets the workout data within a given timeframe.

workout_test.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ var workoutCases = []struct {
3030
"activity": "walking",
3131
"calories": 106.206,
3232
"day": "2022-04-02",
33-
"distance": "2.3",
33+
"distance": 2.3,
3434
"end_datetime": "2022-04-02T15:12:00+01:00",
3535
"intensity": "moderate",
3636
"label": "foo",
@@ -41,7 +41,7 @@ var workoutCases = []struct {
4141
"activity": "cycling",
4242
"calories": 350.784,
4343
"day": "2022-04-02",
44-
"distance": "50.2",
44+
"distance": 50.2,
4545
"end_datetime": "2022-04-02T20:36:00+01:00",
4646
"intensity": "moderate",
4747
"label": "bar",
@@ -99,8 +99,7 @@ func testWorkouts(t *testing.T, start_date, end_date, next_token, expectedURL, m
9999
got, _, err := client.Workouts(context.Background(), start_date, end_date, next_token)
100100
assert.NoError(t, err, "should not return an error")
101101

102-
want := &Sessions{}
102+
want := &Workouts{}
103103
json.Unmarshal([]byte(mock), want) //nolint:errcheck
104-
105104
assert.ObjectsAreEqual(want, got)
106105
}

0 commit comments

Comments
 (0)