Files
zapstore/test/services/settings_service_test.dart
T
franzap 788b371f32 Store app catalog relays as device-signed kind 10067 events.
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.
2026-06-27 17:20:21 -03:00

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');
});
});
}