feat(auth): 登录页改为 ymb 品牌并支持后台配置背景图

This commit is contained in:
Vicky authored and trae-solo-agent committed 2026-10-30 17:14:30 +08:00
1 parent 22cc669bbe
commit e7399fa3fd
24 files changed
+378 -188

No files matched your search

+53
View File
@@ -0,0 +1,53 @@
// Author: fruit.com.cn
import 'package:flutter_test/flutter_test.dart';
import 'package:fruitshorts/core/data/remote/api_client.dart';
import 'package:fruitshorts/core/data/remote/config_api.dart';
import 'package:fruitshorts/core/data/services/app_config_controller.dart';
import '../support/fake_http_adapter.dart';
AppConfigController _controller(FakeHttpAdapter adapter) => AppConfigController(
ConfigApi(ApiClient(baseUrl: 'http://127.0.0.1:1', adapter: adapter)),
);
void main() {
test('should_use_backend_url_when_login_background_is_configured', () async {
final controller = _controller(
FakeHttpAdapter(
(_) async => FakeHttpResponse(
'{"code":0,"data":{"loginBackgroundUrl":"/files/login_bg/bg.jpg"}}',
),
),
);
await controller.load();
expect(controller.loginBackgroundUrl, '/files/login_bg/bg.jpg');
});
test('should_treat_blank_value_as_not_configured', () async {
final controller = _controller(
FakeHttpAdapter(
(_) async =>
FakeHttpResponse('{"code":0,"data":{"loginBackgroundUrl":" "}}'),
),
);
await controller.load();
expect(controller.loginBackgroundUrl, isEmpty);
});
test('should_keep_local_default_when_config_request_fails', () async {
var notified = 0;
final controller = _controller(
FakeHttpAdapter((_) async => FakeHttpResponse('{}', 500)),
)..addListener(() => notified++);
await controller.load();
expect(controller.loginBackgroundUrl, isEmpty);
expect(notified, 0);
});
}