mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-26 01:10:39 +00:00
fixed LightSensorService
tests
This commit is contained in:
parent
467f13e5e4
commit
602a8d4cf3
1 changed files with 5 additions and 5 deletions
|
@ -44,19 +44,19 @@ void main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('true - Android', () async {
|
test('true - Android', () async {
|
||||||
when(() => localPlatform.isAndroid).thenReturn(true);
|
when(() => localPlatform.isIOS).thenReturn(false);
|
||||||
setMockSensorAvailability(hasSensor: true);
|
setMockSensorAvailability(hasSensor: true);
|
||||||
expectLater(service.hasSensor(), completion(true));
|
expectLater(service.hasSensor(), completion(true));
|
||||||
});
|
});
|
||||||
|
|
||||||
test('false - Android', () async {
|
test('false - Android', () async {
|
||||||
when(() => localPlatform.isAndroid).thenReturn(true);
|
when(() => localPlatform.isIOS).thenReturn(false);
|
||||||
setMockSensorAvailability(hasSensor: false);
|
setMockSensorAvailability(hasSensor: false);
|
||||||
expectLater(service.hasSensor(), completion(false));
|
expectLater(service.hasSensor(), completion(false));
|
||||||
});
|
});
|
||||||
|
|
||||||
test('false - iOS', () async {
|
test('false - iOS', () async {
|
||||||
when(() => localPlatform.isAndroid).thenReturn(false);
|
when(() => localPlatform.isIOS).thenReturn(true);
|
||||||
expectLater(service.hasSensor(), completion(false));
|
expectLater(service.hasSensor(), completion(false));
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -64,7 +64,7 @@ void main() {
|
||||||
|
|
||||||
group('luxStream', () {
|
group('luxStream', () {
|
||||||
test('Android', () async {
|
test('Android', () async {
|
||||||
when(() => localPlatform.isAndroid).thenReturn(true);
|
when(() => localPlatform.isIOS).thenReturn(false);
|
||||||
final stream = service.luxStream();
|
final stream = service.luxStream();
|
||||||
final List<int> result = [];
|
final List<int> result = [];
|
||||||
final subscription = stream.listen(result.add);
|
final subscription = stream.listen(result.add);
|
||||||
|
@ -77,7 +77,7 @@ void main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('iOS', () async {
|
test('iOS', () async {
|
||||||
when(() => localPlatform.isAndroid).thenReturn(false);
|
when(() => localPlatform.isIOS).thenReturn(true);
|
||||||
expect(service.luxStream(), const Stream<int>.empty());
|
expect(service.luxStream(), const Stream<int>.empty());
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue