Skip to content

Commit 312a98a

Browse files
committed
adjust unit tests for new WorkoutSummary Structure
1 parent c1ec5ea commit 312a98a

File tree

2 files changed

+35
-36
lines changed

2 files changed

+35
-36
lines changed

lib/data/workoutsummary.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class WorkoutSummary extends TimestampedData {
7575
"avgSPM: $avgSPM)";
7676
}
7777

78-
class WorkoutSummary2 {
78+
class WorkoutSummary2 extends TimestampedData {
7979
IntervalType intervalType;
8080
int intervalSize;
8181
int intervalCount;
@@ -107,5 +107,6 @@ class WorkoutSummary2 {
107107
intervalRestTime = CsafeIntExtension.fromBytes(data.sublist(15, 17),
108108
endian: Endian.little),
109109
avgCalories = CsafeIntExtension.fromBytes(data.sublist(17, 19),
110-
endian: Endian.little) {}
110+
endian: Endian.little),
111+
super.fromBytes(data);
111112
}

test/workoutsummary_test.dart

Lines changed: 32 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ void main() {
5050
0
5151
];
5252

53-
List<int> bothSets = basicBytes + extendedBytes;
53+
// List<int> bothSets = basicBytes + extendedBytes;
5454

5555
test('can extract basic values from a workout summary byte list', () {
5656
final summary = WorkoutSummary.fromBytes(Uint8List.fromList(basicBytes));
@@ -65,14 +65,12 @@ void main() {
6565
expect(summary.avgDragFactor, 120);
6666
expect(summary.workoutType, WorkoutType.JUSTROW_SPLITS);
6767
expect(summary.avgPace, 10);
68-
expect(summary.watts, null);
6968
});
7069

71-
test(
72-
'can extract basic and extended values from a workout summary byte list',
73-
() {
74-
final summary = WorkoutSummary.fromBytes(Uint8List.fromList(bothSets));
75-
// expect(summary.timestamp, DateTime(2000, 0, 0, 0, 0));
70+
test('can extract extended values from a workout summary byte list', () {
71+
final summary =
72+
WorkoutSummary2.fromBytes(Uint8List.fromList(extendedBytes));
73+
expect(summary.timestamp, DateTime(2000, 0, 0, 0, 0));
7674
expect(summary.intervalType, IntervalType.TIME);
7775
expect(summary.intervalSize, 255);
7876
expect(summary.intervalCount, 2);
@@ -83,34 +81,34 @@ void main() {
8381
expect(summary.avgCalories, 100);
8482
});
8583

86-
test('fails if it receives two different datetime values', () {
87-
List<int> modifiedDateBytes = [
88-
42,
89-
0,
90-
0,
91-
0,
92-
0,
93-
255,
94-
0,
95-
2,
96-
34,
97-
0,
98-
196,
99-
0,
100-
72,
101-
0,
102-
0,
103-
55,
104-
0,
105-
100,
106-
0
107-
];
84+
// test('fails if it receives two different datetime values', () {
85+
// List<int> modifiedDateBytes = [
86+
// 42,
87+
// 0,
88+
// 0,
89+
// 0,
90+
// 0,
91+
// 255,
92+
// 0,
93+
// 2,
94+
// 34,
95+
// 0,
96+
// 196,
97+
// 0,
98+
// 72,
99+
// 0,
100+
// 0,
101+
// 55,
102+
// 0,
103+
// 100,
104+
// 0
105+
// ];
108106

109-
Uint8List differentSets =
110-
Uint8List.fromList(basicBytes + modifiedDateBytes);
107+
// Uint8List differentSets =
108+
// Uint8List.fromList(basicBytes + modifiedDateBytes);
111109

112-
expect(
113-
() => WorkoutSummary.fromBytes(differentSets), throwsArgumentError);
114-
});
110+
// expect(
111+
// () => WorkoutSummary.fromBytes(differentSets), throwsArgumentError);
112+
// });
115113
});
116114
}

0 commit comments

Comments
 (0)