feat(account): 增加账号中心页面与入口

This commit is contained in:
Zhou Weidong committed 2026-10-19 09:50:23 +08:00
1 parent c68f02449f
commit da095115d4
23 files changed
+2343 -60

No files matched your search

+8 -21
View File
@@ -13,9 +13,8 @@ void main() {
String envelope(Object? data, {int code = 0, String message = 'ok'}) =>
jsonEncode({'code': code, 'message': message, 'data': data});
AccountApi apiWith(FakeHttpAdapter adapter) => AccountApi(
ApiClient(baseUrl: 'http://127.0.0.1:8081', adapter: adapter),
);
AccountApi apiWith(FakeHttpAdapter adapter) =>
AccountApi(ApiClient(baseUrl: 'http://127.0.0.1:8081', adapter: adapter));
test('should_get_profile_and_parse_numeric_vip_level', () async {
final adapter = FakeHttpAdapter(
@@ -90,11 +89,7 @@ void main() {
'status': 'active',
'deleted': 0,
},
{
'id': 7,
'deviceId': 'd-android-5678',
'platform': 'ANDROID',
},
{'id': 7, 'deviceId': 'd-android-5678', 'platform': 'ANDROID'},
]),
),
);
@@ -138,14 +133,10 @@ void main() {
test('should_request_deactivation_with_reason_and_parse_schedule', () async {
final adapter = FakeHttpAdapter(
(_) async => FakeHttpResponse(
envelope('2026-11-03T09:30:00'),
),
(_) async => FakeHttpResponse(envelope('2026-11-03T09:30:00')),
);
final scheduledAt = await apiWith(
adapter,
).deactivate(reason: '不再使用');
final scheduledAt = await apiWith(adapter).deactivate(reason: '不再使用');
expect(adapter.requests.single.method, 'POST');
expect(adapter.requests.single.uri.path, '/app/me/deactivate');
@@ -161,18 +152,14 @@ void main() {
await apiWith(adapter).cancelDeactivation();
expect(adapter.requests.single.method, 'POST');
expect(
adapter.requests.single.uri.path,
'/app/me/deactivate/cancel',
);
expect(adapter.requests.single.uri.path, '/app/me/deactivate/cancel');
expect(adapter.requests.single.data, isNull);
});
test('should_keep_backend_message_when_cancel_fails', () async {
final adapter = FakeHttpAdapter(
(_) async => FakeHttpResponse(
envelope(null, code: 100009, message: '没有待处理的注销申请'),
),
(_) async =>
FakeHttpResponse(envelope(null, code: 100009, message: '没有待处理的注销申请')),
);
await expectLater(