Refresh the Flutter snapshot: v3 tickets V3-04 through V3-16, plus a fresh installable APK

V3-04 through V3-07, V3-10, V3-16 shipped complete; V3-11/V3-12/V3-14 shipped code-complete pending device/account verification; V3-08/V3-09 deferred behind a new V3-17 (self-hosted OSRM investigation). 316 tests passing, up from 221.

The APK is a fresh release build (debug-signed, no release signing config exists yet) with two build fixes applied: core library desugaring enabled for flutter_local_notifications, and sentry_flutter bumped to 9.27.0 (8.14.2's bundled Kotlin plugin was incompatible with this project's Kotlin 2.4.0 toolchain).
This commit is contained in:
2026-08-19 13:36:04 -05:00
parent 14289befb0
commit 4c634354bd
48 changed files with 4436 additions and 224 deletions

View File

@@ -0,0 +1,113 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:rippr/src/config/config.dart';
import 'package:rippr/src/domain/models.dart';
import 'package:shared_preferences/shared_preferences.dart';
/// `Config` had no dedicated tests before V3-03 — every existing widget test leaves
/// `configProvider` null, so this is its first direct coverage.
void main() {
Future<Config> freshConfig([Map<String, Object> initial = const {}]) async {
SharedPreferences.setMockInitialValues(initial);
return Config.load();
}
group('unitSystem', () {
test('an explicit choice always wins over the locale default', () async {
final config = await freshConfig();
await config.setUnitSystem(UnitSystem.imperial);
expect(config.unitSystem, UnitSystem.imperial);
await config.setUnitSystem(UnitSystem.metric);
expect(config.unitSystem, UnitSystem.metric);
});
test('with nothing stored, falls back to a locale default without throwing', () async {
// The exact value is environment-dependent (it reads the real platform locale),
// so this asserts the fallback path is safe to reach, not a specific answer.
final config = await freshConfig();
expect(config.unitSystem, isA<UnitSystem>());
});
});
group('mapEnabled', () {
test('defaults to true', () async {
final config = await freshConfig();
expect(config.mapEnabled, isTrue);
});
test('round-trips through set/get', () async {
final config = await freshConfig();
await config.setMapEnabled(false);
expect(config.mapEnabled, isFalse);
});
});
group('mountedMode', () {
test('defaults to false', () async {
final config = await freshConfig();
expect(config.mountedMode, isFalse);
});
test('round-trips through set/get', () async {
final config = await freshConfig();
await config.setMountedMode(true);
expect(config.mountedMode, isTrue);
});
});
group('crashReportingEnabled', () {
test('defaults to false', () async {
final config = await freshConfig();
expect(config.crashReportingEnabled, isFalse);
});
test('round-trips through set/get', () async {
final config = await freshConfig();
await config.setCrashReportingEnabled(true);
expect(config.crashReportingEnabled, isTrue);
});
});
group('uploadEndpoint', () {
test('defaults to empty, not null or a placeholder', () async {
final config = await freshConfig();
expect(config.uploadEndpoint, '');
});
test('trims whitespace on write', () async {
final config = await freshConfig();
await config.setUploadEndpoint(' https://example.test/ingest ');
expect(config.uploadEndpoint, 'https://example.test/ingest');
});
});
group('deviceId', () {
test('is generated once and then stable across reads', () async {
final config = await freshConfig();
final first = config.deviceId;
final second = config.deviceId;
expect(first, second);
expect(first, isNotEmpty);
});
test('is a v4 UUID', () async {
final config = await freshConfig();
// xxxxxxxx-xxxx-4xxx-{8,9,a,b}xxx-xxxxxxxxxxxx
final v4 = RegExp(
r'^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$',
);
expect(v4.hasMatch(config.deviceId), isTrue,
reason: 'got ${config.deviceId}');
});
test('persists across a fresh Config over the same preferences', () async {
SharedPreferences.setMockInitialValues({});
final first = await Config.load();
final id = first.deviceId;
final second = await Config.load();
expect(second.deviceId, id,
reason: 'a server distinguishing riders needs this to be stable');
});
});
}