fix(app): a way out when this device's data can't be opened

The screen that says "Couldn't open this device's data." had no button, so the person was stuck until they restarted the app. It now offers "Try again", which opens the person's data anew; a test covers a first attempt that fails and a second that works.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-09-30 15:13:34 +02:00
commit 231369900b
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -56,6 +56,28 @@ void main() {
await tester.pump();
});
testWidgets('offers to try again; an attempt that works shows the app', (
tester,
) async {
var attempts = 0;
await showScope(tester, () async {
if (++attempts == 1) {
throw Exception('Disk busy');
}
return PersonDependencies(
studysets: StudysetRepository(FakeStudysetGateway()),
cards: CardRepository(FakeCardGateway()),
);
});
expect(find.text("Couldn't open this device's data."), findsOneWidget);
await tester.tap(find.text('Try again'));
await tester.pumpAndSettle();
expect(find.text('Home'), findsOneWidget);
expect(attempts, 2);
});
testWidgets("closes the person's data when it goes away", (tester) async {
var closed = false;
await showScope(