mirror of
https://github.com/kuhyx/todo-app.git
synced 2026-11-19 14:14:24 +01:00
Some checks failed
dependency freshness / dependencies on newest stable (push) Has been cancelled
file-length / file length <= 250 lines (push) Has been cancelled
md-naming / markdown naming convention (push) Has been cancelled
release-apk / release (APK) (push) Has been cancelled
repo-contract / repo contract (push) Has been cancelled
crdt_sync_flutter 0.9.0's installAppErrors in main(): uncaught errors and every spinner shown over 1 s (WaitWatch: sync.run, mirror.test) upload to RTDB /todo/errors/<device> with the versionCode, where the PC app-errors ingest files board tickets (kuhyx/utils DOCS-app-errors.md). The app moves to material_ui first: sync_settings_ui 0.8.x and design_system 0.4.x sit on it, and Flutter 3.50 deprecates flutter/material. Pins: crdt_sync 0.14.1, csf 0.9.0, ssui 0.8.3, gda 0.5.1, design_system 0.4.1, image 4.13.1, mcp_dart 2.4.4. file_picker stays 13.3.3, held by data_transfer_flutter 0.2.2 (allowlisted, self-clearing). appRoute takes a route name so each report names its screen; the release build passes APP_BUILD/APP_VERSION. Nothing new on screen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
84 lines
2.6 KiB
Dart
84 lines
2.6 KiB
Dart
/// The pumpMirror harness and the fake url_launcher.
|
|
///
|
|
/// Shared by the files `github_mirror_screen_test.dart` was split into for the
|
|
/// 250-line cap. Deliberately NOT named `*_test.dart`: the runner would
|
|
/// collect it and fail on the missing `main()`.
|
|
library;
|
|
|
|
import 'dart:convert';
|
|
|
|
import 'package:crdt_sync/crdt_sync.dart';
|
|
import 'package:material_ui/material_ui.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:http/http.dart' as http;
|
|
import 'package:http/testing.dart';
|
|
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
import 'package:todo/data/app_settings.dart';
|
|
import 'package:todo/sync/sync_settings.dart';
|
|
import 'package:todo/ui/github_mirror_screen.dart';
|
|
import 'package:url_launcher_platform_interface/link.dart';
|
|
import 'package:url_launcher_platform_interface/url_launcher_platform_interface.dart';
|
|
|
|
import 'fake_note_repository.dart';
|
|
import 'fake_secure_storage.dart';
|
|
|
|
/// Stub launcher that records the URL instead of opening it, so `_openPage`
|
|
/// can be exercised without a real platform channel.
|
|
class _FakeUrlLauncher extends UrlLauncherPlatform
|
|
with MockPlatformInterfaceMixin {
|
|
String? launched;
|
|
|
|
@override
|
|
final LinkDelegate? linkDelegate = null;
|
|
|
|
@override
|
|
Future<bool> supportsMode(PreferredLaunchMode mode) async => true;
|
|
|
|
@override
|
|
Future<bool> launchUrl(String url, LaunchOptions options) async {
|
|
launched = url;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
Future<FakeNoteRepository> pumpMirror(
|
|
WidgetTester tester, {
|
|
SyncSettings initial = const SyncSettings(
|
|
owner: 'kuhyx',
|
|
repo: 'syncs',
|
|
token: 't',
|
|
),
|
|
http.Client? httpClient,
|
|
FakeNoteRepository? repository,
|
|
Future<FirebaseRestClient?> Function()? firebaseFactory,
|
|
ValueNotifier<AppSettings>? appSettings,
|
|
}) async {
|
|
SharedPreferences.setMockInitialValues({});
|
|
installFakeSecureStorage();
|
|
tester.view.physicalSize = const Size(1200, 2800);
|
|
tester.view.devicePixelRatio = 1.0;
|
|
addTearDown(tester.view.resetPhysicalSize);
|
|
addTearDown(tester.view.resetDevicePixelRatio);
|
|
|
|
final repo = repository ?? FakeNoteRepository();
|
|
addTearDown(repo.close);
|
|
await tester.pumpWidget(
|
|
MaterialApp(
|
|
home: GitHubMirrorScreen(
|
|
initial: initial,
|
|
repository: repo,
|
|
appSettings:
|
|
appSettings ??
|
|
ValueNotifier(const AppSettings(advancedMode: false)),
|
|
httpClient: httpClient,
|
|
firebaseFactory: firebaseFactory ?? () async => null,
|
|
stateStore: InMemorySyncStateStore(),
|
|
),
|
|
),
|
|
);
|
|
await tester.pump();
|
|
return repo;
|
|
}
|