feat: add setting for auto-lock fix: fix sideswipe
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import 'package:drift/native.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:kooltab2/database/app_database.dart';
|
||||
import 'package:kooltab2/models/settings.dart';
|
||||
import 'package:kooltab2/services/settings_service.dart';
|
||||
|
||||
void main() {
|
||||
late AppDatabase database;
|
||||
late DriftSettingsService service;
|
||||
|
||||
setUp(() {
|
||||
database = AppDatabase(NativeDatabase.memory());
|
||||
service = DriftSettingsService(database: database);
|
||||
});
|
||||
|
||||
tearDown(() async {
|
||||
await database.close();
|
||||
});
|
||||
|
||||
test('defaults auto-lock to enabled', () async {
|
||||
final settings = await service.getSettings();
|
||||
|
||||
expect(settings, AppSettings.defaults);
|
||||
expect(settings.autoLockEnabled, isTrue);
|
||||
});
|
||||
|
||||
test('persists the auto-lock setting', () async {
|
||||
await service.saveSettings(
|
||||
AppSettings.defaults.copyWith(autoLockEnabled: false),
|
||||
);
|
||||
|
||||
final settings = await service.getSettings();
|
||||
|
||||
expect(settings.autoLockEnabled, isFalse);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user