feat(mobile): album management pages with qr share
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -69,18 +69,21 @@ void main() {
|
||||
testWidgets('退出登录 → api.logout + 清会话 + 清栈回 /login(服务端失败亦然)',
|
||||
(tester) async {
|
||||
// 服务端撤销失败(500)也照样本地登出——尽力而为语义。
|
||||
final adapter = FakeAdapter(
|
||||
(o) => o.path == '/v1/auth/logout'
|
||||
? (500, errorBody('INTERNAL_ERROR'))
|
||||
: throw StateError('unexpected ${o.path}'),
|
||||
);
|
||||
// 首页「相册」页签(Task 4)进入即自动拉列表,需一并兜底路由。
|
||||
final adapter = FakeAdapter((o) {
|
||||
if (o.path == '/v1/auth/logout') return (500, errorBody('INTERNAL_ERROR'));
|
||||
if (o.path == '/v1/albums') return (500, errorBody('INTERNAL_ERROR'));
|
||||
throw StateError('unexpected ${o.path}');
|
||||
});
|
||||
await pumpHome(tester, clientOf(adapter));
|
||||
|
||||
await tester.tap(find.text('Sign out'));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(adapter.requests.single.path, '/v1/auth/logout');
|
||||
expect(adapter.requests.single.method, 'POST');
|
||||
final logout = adapter.requests.singleWhere(
|
||||
(r) => r.path == '/v1/auth/logout',
|
||||
);
|
||||
expect(logout.method, 'POST');
|
||||
expect(store.session, isNull, reason: '本地会话必须清除');
|
||||
expect(find.byType(LoginPage), findsOneWidget);
|
||||
expect(find.byType(HomePage), findsNothing, reason: '主壳已出栈');
|
||||
|
||||
Reference in New Issue
Block a user