mirror of
https://github.com/zapstore/zapstore.git
synced 2026-10-05 20:48:24 +00:00
Relay lists now load from the accepted local event with a hardcoded default fallback, sync in the background from relay.zapstore.dev, and require confirmation before the existing clear-and-restart apply path.
34 lines
1.1 KiB
Dart
34 lines
1.1 KiB
Dart
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:zapstore/services/settings_service.dart';
|
|
|
|
void main() {
|
|
group('LocalSettings', () {
|
|
test('backgroundAutoUpdatesEnabled defaults to false', () {
|
|
const settings = LocalSettings();
|
|
expect(settings.backgroundAutoUpdatesEnabled, isFalse);
|
|
});
|
|
|
|
test('round-trips backgroundAutoUpdatesEnabled in JSON', () {
|
|
const settings = LocalSettings(backgroundAutoUpdatesEnabled: true);
|
|
final restored = LocalSettings.fromJson(settings.toJson());
|
|
expect(restored.backgroundAutoUpdatesEnabled, isTrue);
|
|
});
|
|
|
|
test('copyWith toggles backgroundAutoUpdatesEnabled', () {
|
|
const settings = LocalSettings();
|
|
final updated = settings.copyWith(backgroundAutoUpdatesEnabled: true);
|
|
expect(updated.backgroundAutoUpdatesEnabled, isTrue);
|
|
});
|
|
|
|
test('discards legacy relay settings', () {
|
|
final restored = LocalSettings.fromJson({
|
|
'relays': ['wss://legacy.example'],
|
|
'logLevel': 'info',
|
|
});
|
|
|
|
expect(restored.toJson(), isNot(contains('relays')));
|
|
expect(restored.toJson()['logLevel'], 'info');
|
|
});
|
|
});
|
|
}
|