Skip to content

Commit

Permalink
fix: provider test
Browse files Browse the repository at this point in the history
  • Loading branch information
Suraj Adhikari committed Feb 18, 2022
1 parent 1f250a3 commit 7f6345e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions lib/traits/thermostat_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class ThermostatWidget extends StatelessWidget with ToastNotifications {
_thermostatProvider.deviceDetail!.id, value);
});
},
key: Key('thermostat_${isCool ? 'cool' : 'hot'}_slider'),
),
],
);
Expand Down
11 changes: 7 additions & 4 deletions test/providers/thermostat_provider_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ class GetThermostatDetails extends Mock {
Future<Device> call(Request request, String id);
}

final heatTemperatureRange = TemperatureRange(min: 0, max: 100);
final coolTemperatureRange = TemperatureRange(min: 0, max: 100);

@GenerateMocks([
SetPoint,
SetMode,
Expand Down Expand Up @@ -141,9 +144,9 @@ void main() {
expect(thermostatProvider.getAvailableFanModes, hasLength(3));
expect(thermostatProvider.getAvailableThermostatModes, hasLength(3));
expect((thermostatProvider.getHeatTemperatureRange),
equals(TemperatureRange(min: 0, max: 100)));
equals(heatTemperatureRange));
expect((thermostatProvider.getCoolTemperatureRange),
equals(TemperatureRange(min: 0, max: 100)));
equals(coolTemperatureRange));
});
}

Expand All @@ -170,8 +173,8 @@ Device _getThermostat(double temp) {
AvailableThermostatMode.COOL,
AvailableThermostatMode.HEAT
}),
HeatSetPointRange(TemperatureRange(min: 0, max: 100)),
CoolSetPointRange(TemperatureRange(min: 0, max: 100)),
HeatSetPointRange(heatTemperatureRange),
CoolSetPointRange(coolTemperatureRange),
})
],
);
Expand Down

0 comments on commit 7f6345e

Please sign in to comment.