mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-21 23:10:40 +00:00
added Stream.empty()
tests
This commit is contained in:
parent
83476a5036
commit
da152dcd37
3 changed files with 31 additions and 2 deletions
|
@ -17,5 +17,10 @@ class LightSensorService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Stream<int> luxStream() => LightSensor.lightSensorStream;
|
Stream<int> luxStream() {
|
||||||
|
if (!localPlatform.isAndroid) {
|
||||||
|
return const Stream<int>.empty();
|
||||||
|
}
|
||||||
|
return LightSensor.lightSensorStream;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,4 +83,16 @@ void main() {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
group('luxStream', () {
|
||||||
|
// test('Android', () async {
|
||||||
|
// when(() => localPlatform.isAndroid).thenReturn(true);
|
||||||
|
// expect(service.luxStream(), const Stream.empty());
|
||||||
|
// });
|
||||||
|
|
||||||
|
test('iOS', () async {
|
||||||
|
when(() => localPlatform.isAndroid).thenReturn(false);
|
||||||
|
expect(service.luxStream(), const Stream<int>.empty());
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ void main() {
|
||||||
|
|
||||||
late _MockLocalPlatform localPlatform;
|
late _MockLocalPlatform localPlatform;
|
||||||
late VolumeEventsService service;
|
late VolumeEventsService service;
|
||||||
|
|
||||||
Future<Object?>? methodCallSuccessHandler(MethodCall methodCall) async {
|
Future<Object?>? methodCallSuccessHandler(MethodCall methodCall) async {
|
||||||
switch (methodCall.method) {
|
switch (methodCall.method) {
|
||||||
case "setVolumeHandling":
|
case "setVolumeHandling":
|
||||||
|
@ -58,4 +58,16 @@ void main() {
|
||||||
expectLater(service.setVolumeHandling(false), completion(false));
|
expectLater(service.setVolumeHandling(false), completion(false));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
group('volumeButtonsEventStream', () {
|
||||||
|
// test('Android', () async {
|
||||||
|
// when(() => localPlatform.isAndroid).thenReturn(true);
|
||||||
|
// expect(service.volumeButtonsEventStream(), const Stream.empty());
|
||||||
|
// });
|
||||||
|
|
||||||
|
test('iOS', () async {
|
||||||
|
when(() => localPlatform.isAndroid).thenReturn(false);
|
||||||
|
expect(service.volumeButtonsEventStream(), const Stream<int>.empty());
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue