Skip to content

Commit

Permalink
fix: Fix build from any Null test error
Browse files Browse the repository at this point in the history
  • Loading branch information
rlperez committed Nov 17, 2021
1 parent 3aaadfa commit 15edc76
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
8 changes: 4 additions & 4 deletions lib/components/modes_toolbar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ModesToolbar extends StatelessWidget {
onPressed: () {
if (deviceId != null) {
thermostatProvider.setThermostatMode(
deviceId, GThermostatMode.AUTO);
deviceId!, GThermostatMode.AUTO);
}
},
),
Expand All @@ -31,7 +31,7 @@ class ModesToolbar extends StatelessWidget {
onPressed: () {
if (deviceId != null) {
thermostatProvider.setThermostatMode(
deviceId, GThermostatMode.COOL);
deviceId!, GThermostatMode.COOL);
}
},
),
Expand All @@ -40,7 +40,7 @@ class ModesToolbar extends StatelessWidget {
onPressed: () {
if (deviceId != null) {
thermostatProvider.setThermostatMode(
deviceId, GThermostatMode.HEAT);
deviceId!, GThermostatMode.HEAT);
}
},
),
Expand All @@ -49,7 +49,7 @@ class ModesToolbar extends StatelessWidget {
onPressed: () {
if (deviceId != null) {
thermostatProvider.setThermostatMode(
deviceId, GThermostatMode.AIRFLOW);
deviceId!, GThermostatMode.AIRFLOW);
}
},
),
Expand Down
11 changes: 7 additions & 4 deletions test/components/modes_toolbar_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ void main() {

await tester.tap(find.widgetWithText(ModeIconButton, "A"));

verify(mockProvider.setThermostatMode(any, GThermostatMode.AUTO)).called(1);
verify(mockProvider.setThermostatMode('any', GThermostatMode.AUTO))
.called(1);
});

testWidgets('ModesToolbar - button should set mode to cool when pressed',
Expand All @@ -48,7 +49,8 @@ void main() {

await tester.tap(find.widgetWithIcon(ModeIconButton, Icons.ac_unit));

verify(mockProvider.setThermostatMode(any, GThermostatMode.COOL)).called(1);
verify(mockProvider.setThermostatMode('any', GThermostatMode.COOL))
.called(1);
});

testWidgets('ModesToolbar - button should set mode to heat when pressed',
Expand All @@ -57,7 +59,8 @@ void main() {

await tester.tap(find.widgetWithIcon(ModeIconButton, Icons.whatshot));

verify(mockProvider.setThermostatMode(any, GThermostatMode.HEAT)).called(1);
verify(mockProvider.setThermostatMode('any', GThermostatMode.HEAT))
.called(1);
});

testWidgets('ModesToolbar - button should set mode to eco when pressed',
Expand All @@ -66,7 +69,7 @@ void main() {

await tester.tap(find.widgetWithIcon(ModeIconButton, Icons.eco));

verify(mockProvider.setThermostatMode(any, GThermostatMode.AIRFLOW))
verify(mockProvider.setThermostatMode('any', GThermostatMode.AIRFLOW))
.called(1);
});

Expand Down
11 changes: 7 additions & 4 deletions test/widgets/components/modes_toolbar_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ void main() {

await tester.tap(find.widgetWithText(ModeIconButton, "A"));

verify(mockProvider.setThermostatMode(any, GThermostatMode.AUTO)).called(1);
verify(mockProvider.setThermostatMode('any', GThermostatMode.AUTO))
.called(1);
});

testWidgets('ModesToolbar - button should set mode to cool when pressed',
Expand All @@ -47,7 +48,8 @@ void main() {

await tester.tap(find.widgetWithIcon(ModeIconButton, Icons.ac_unit));

verify(mockProvider.setThermostatMode(any, GThermostatMode.COOL)).called(1);
verify(mockProvider.setThermostatMode('any', GThermostatMode.COOL))
.called(1);
});

testWidgets('ModesToolbar - button should set mode to heat when pressed',
Expand All @@ -56,7 +58,8 @@ void main() {

await tester.tap(find.widgetWithIcon(ModeIconButton, Icons.whatshot));

verify(mockProvider.setThermostatMode(any, GThermostatMode.HEAT)).called(1);
verify(mockProvider.setThermostatMode('any', GThermostatMode.HEAT))
.called(1);
});

testWidgets('ModesToolbar - button should set mode to eco when pressed',
Expand All @@ -65,7 +68,7 @@ void main() {

await tester.tap(find.widgetWithIcon(ModeIconButton, Icons.eco));

verify(mockProvider.setThermostatMode(any, GThermostatMode.AIRFLOW))
verify(mockProvider.setThermostatMode('any', GThermostatMode.AIRFLOW))
.called(1);
});
}

0 comments on commit 15edc76

Please sign in to comment.