Files
potato-mesh/app/test/theme_preference_store_test.dart
T
l5y e432c843c3 app: add theme selector (#507)
* app: add theme selector

* address review comments
2025-11-24 22:02:06 +01:00

38 lines
1.2 KiB
Dart

// Copyright © 2025-26 l5yth & contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:potato_mesh_reader/main.dart';
import 'package:shared_preferences/shared_preferences.dart';
void main() {
TestWidgetsFlutterBinding.ensureInitialized();
setUp(() {
SharedPreferences.setMockInitialValues({});
});
test('ThemePreferenceStore persists and restores theme mode', () async {
final store = ThemePreferenceStore();
final initial = await store.load();
expect(initial, ThemeMode.system);
await store.save(ThemeMode.dark);
final loaded = await store.load();
expect(loaded, ThemeMode.dark);
});
}