35 lines
1.1 KiB
Dart
35 lines
1.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
import 'package:smoke_cess_app/mock/settings_mock.dart';
|
|
import 'package:smoke_cess_app/providers/settings_provider.dart';
|
|
|
|
void main() {
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
SharedPreferences.setMockInitialValues(mockSettings);
|
|
group('SettingsProvider', () {
|
|
test('initial state', () {
|
|
final provider = SettingsProvider();
|
|
expect(provider.settings, isNull);
|
|
expect(provider.initialized, isFalse);
|
|
expect(provider.scanning, isFalse);
|
|
});
|
|
|
|
test('initialize mocksettings', () async {
|
|
final provider = SettingsProvider();
|
|
await provider.initSettings();
|
|
expect(provider.settings, isNotNull);
|
|
expect(provider.initialized, isTrue);
|
|
expect(provider.settings?.group, 3);
|
|
});
|
|
|
|
test('set scanning', () {
|
|
final provider = SettingsProvider();
|
|
provider.scanning = true;
|
|
expect(provider.scanning, isTrue);
|
|
provider.scanning = false;
|
|
expect(provider.scanning, isFalse);
|
|
});
|
|
});
|
|
}
|