fix(app): a sign-out or deletion that failed says so, its tile showing it under way
The account's tiles show a spinner on Sign out or Delete account while it
runs, start neither again meanwhile, and say once, in a snack bar, why one
failed ("Couldn't delete your account: the instance wasn't reached. Try
again."; "Couldn't sign out on this device. Try again."), in English and
German. The session gate no longer builds the person's app anew for that:
only the tiles follow it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
662c30b117
commit
f5d8a3ca1f
1 changed files with 192 additions and 6 deletions
|
|
@ -1,7 +1,10 @@
|
|||
import 'dart:async';
|
||||
|
||||
import 'package:clock/clock.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:halkyon_app/halkyon_app.dart';
|
||||
import 'package:halkyon_app/testing.dart';
|
||||
import 'package:halkyon_ui/halkyon_ui.dart';
|
||||
import 'package:material_ui/material_ui.dart';
|
||||
|
||||
/// A signed-in person's app as a test makes one: whose it is, and the
|
||||
|
|
@ -344,6 +347,75 @@ void main() {
|
|||
expect(find.text('Signed out'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('while the account is deleted, the person stays in their app, '
|
||||
'Delete account showing it is under way', (tester) async {
|
||||
await start(tester);
|
||||
gateway.deletionWaits = Completer();
|
||||
|
||||
await tester.tap(find.text('Delete account'));
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.text('Delete account').last);
|
||||
// The spinner never settles while it runs.
|
||||
await tester.pump();
|
||||
await tester.pump(const Duration(milliseconds: 100));
|
||||
|
||||
expect(
|
||||
find.text('App of anonymous-1'),
|
||||
findsOneWidget,
|
||||
reason: 'never the launch screen in between',
|
||||
);
|
||||
expect(
|
||||
find.descendant(
|
||||
of: find.widgetWithText(ListTile, 'Delete account'),
|
||||
matching: find.byType(ButtonLoadingIndicator),
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
|
||||
gateway.deletionWaits!.complete();
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Signed out'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('a deletion the instance never got keeps the person in their '
|
||||
'app, and says so once', (tester) async {
|
||||
await start(tester);
|
||||
gateway.deletionError = Exception('No connection');
|
||||
|
||||
await tester.tap(find.text('Delete account'));
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.text('Delete account').last);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(
|
||||
find.text(
|
||||
"Couldn't delete your account: the instance wasn't reached. "
|
||||
'Try again.',
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(find.text('App of anonymous-1'), findsOneWidget);
|
||||
expect(gateway.status, isA<SignedIn>());
|
||||
expect(find.byType(ButtonLoadingIndicator), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets("a sign-out the device's storage failed keeps the person in "
|
||||
'their app, and says so', (tester) async {
|
||||
gateway = FakeAuthGateway(
|
||||
status: const SignedIn(authUserId: 'github-1', isIdentified: true),
|
||||
)..signOutError = Exception('The keyring is locked');
|
||||
await start(tester);
|
||||
|
||||
await tester.tap(find.text('Sign out'));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(
|
||||
find.text("Couldn't sign out on this device. Try again."),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(find.text('App of github-1'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('speaks German', (tester) async {
|
||||
await start(tester);
|
||||
final german = lookupHalkyonAppLocalizations(const Locale('de'));
|
||||
|
|
@ -358,5 +430,14 @@ void main() {
|
|||
expect(german.accountSignOutTitle, 'Abmelden?');
|
||||
expect(german.accountDelete, 'Konto löschen');
|
||||
expect(german.accountDeleteTitle, 'Dein Konto löschen?');
|
||||
expect(
|
||||
german.accountSignOutFailed,
|
||||
'Abmelden auf diesem Gerät hat nicht geklappt. Versuch es noch einmal.',
|
||||
);
|
||||
expect(
|
||||
german.accountDeleteFailed,
|
||||
'Dein Konto wurde nicht gelöscht: Die Instanz war nicht erreichbar. '
|
||||
'Versuch es noch einmal.',
|
||||
);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue