added Stream.empty() tests

This commit is contained in:
Vadim 2023-07-09 13:37:53 +02:00
parent 83476a5036
commit da152dcd37
3 changed files with 31 additions and 2 deletions

View file

@ -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;
}
}

View file

@ -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());
});
});
}

View file

@ -58,4 +58,16 @@ void main() {
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());
});
});
}