mirror of
https://github.com/kuhyx/utils.git
synced 2026-11-18 22:14:35 +01:00
gatelock 0.15.1: error_report split into _error_spool, no noqa, INSTALLED holder replaces the module global. Dart app_errors tests split under 250 lines. rtdb_relay dart pins crdt_sync_flutter 0.9.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
34 lines
842 B
Dart
34 lines
842 B
Dart
/// Shared pieces of the app-errors tests: the RTDB sink fake and a config.
|
|
library;
|
|
|
|
import 'package:crdt_sync_flutter/crdt_sync_flutter.dart';
|
|
|
|
/// A sink recording every patch; [fail] makes the next ones throw.
|
|
class FakeSink {
|
|
final patches = <String, Map<String, Object?>>{};
|
|
bool fail = false;
|
|
|
|
Future<void> call(String path, Map<String, Object?> values) async {
|
|
if (fail) throw StateError('offline');
|
|
(patches[path] ??= {}).addAll(values);
|
|
}
|
|
|
|
List<Map<String, Object?>> get entries => [
|
|
for (final v in patches.values.expand((m) => m.values))
|
|
v! as Map<String, Object?>,
|
|
];
|
|
}
|
|
|
|
const config = AppErrorsConfig(
|
|
app: 'todo',
|
|
repo: 'kuhyx/todo',
|
|
build: 42,
|
|
version: '1.2.3',
|
|
);
|
|
|
|
/// An error whose toString throws.
|
|
class ThrowingToString {
|
|
@override
|
|
String toString() => throw StateError('no');
|
|
}
|