Gives HistoryDb an in-memory mode and reconcile() an injectable deployments list so HistoryService can be exercised hermetically, without touching the real history.db or shelling out to rpm-ostree. Covers bootstrap, idempotent reconcile, install-then-reboot, manual/detected changes, last_known_safe, and chain walking. Also fixes the pre-existing widget boot-smoke test: startup now makes a second real Process.run call (via HistoryService.reconcile), which tipped flutter_test's fake-time zone into flagging a dangling Timer from that real I/O. Wrapping the pump in tester.runAsync() is the standard fix. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
22 lines
924 B
Dart
22 lines
924 B
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
import 'package:layer_wizard/main.dart';
|
|
|
|
void main() {
|
|
testWidgets('app boots without crashing', (WidgetTester tester) async {
|
|
// Startup kicks off real async work (reading a file, running
|
|
// `rpm-ostree status`, opening the history DB) behind a
|
|
// CircularProgressIndicator that never "settles" within this test, so
|
|
// this only checks the initial loading frame renders without throwing.
|
|
// runAsync is required because that startup work includes real
|
|
// dart:io Process/FFI calls — without it, flutter_test's fake-time zone
|
|
// flags a dangling Timer from the real I/O once the tree is disposed.
|
|
await tester.runAsync(() async {
|
|
await tester.pumpWidget(const LayerWizardApp());
|
|
await tester.pump();
|
|
});
|
|
|
|
expect(find.byType(CircularProgressIndicator), findsOneWidget);
|
|
});
|
|
}
|