mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-24 16:30:40 +00:00
fixed tests
This commit is contained in:
parent
59d94bf1f1
commit
57ea7d00fb
3 changed files with 7 additions and 3 deletions
|
@ -33,7 +33,11 @@ class RemoteConfigService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> fetchConfig() => FirebaseRemoteConfig.instance.fetch();
|
Future<void> fetchConfig() async {
|
||||||
|
// https://github.com/firebase/flutterfire/issues/6196#issuecomment-927751667
|
||||||
|
await Future.delayed(const Duration(seconds: 1));
|
||||||
|
await FirebaseRemoteConfig.instance.fetch();
|
||||||
|
}
|
||||||
|
|
||||||
dynamic getValue(Feature feature) => FirebaseRemoteConfig.instance.getValue(feature.name).toValue(feature);
|
dynamic getValue(Feature feature) => FirebaseRemoteConfig.instance.getValue(feature.name).toValue(feature);
|
||||||
|
|
||||||
|
|
|
@ -26,8 +26,7 @@ class RemoteConfigProviderState extends State<RemoteConfigProvider> {
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
// https://github.com/firebase/flutterfire/issues/6196#issuecomment-927751667
|
widget.remoteConfigService.fetchConfig();
|
||||||
Future.delayed(const Duration(seconds: 1)).then((_) => widget.remoteConfigService.fetchConfig());
|
|
||||||
_updatesSubscription = widget.remoteConfigService.onConfigUpdated().listen(
|
_updatesSubscription = widget.remoteConfigService.onConfigUpdated().listen(
|
||||||
_updateFeatures,
|
_updateFeatures,
|
||||||
onError: (e) => log(e.toString()),
|
onError: (e) => log(e.toString()),
|
||||||
|
|
|
@ -18,6 +18,7 @@ void main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
setUp(() {
|
setUp(() {
|
||||||
|
when(() => mockRemoteConfigService.fetchConfig()).thenAnswer((_) async {});
|
||||||
when(() => mockRemoteConfigService.getValue(Feature.unlockProFeaturesText)).thenReturn(false);
|
when(() => mockRemoteConfigService.getValue(Feature.unlockProFeaturesText)).thenReturn(false);
|
||||||
when(() => mockRemoteConfigService.getAll()).thenReturn({Feature.unlockProFeaturesText: false});
|
when(() => mockRemoteConfigService.getAll()).thenReturn({Feature.unlockProFeaturesText: false});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue