为什么:a) 应用对外名称要统一成 FruitShorts(产品名,nontonki 是原型代号); b) 首发市场是印尼,界面必须有印尼语;c) 归档要求"新增 id-ID 与改名合并生成一次 l10n,别分两次"。 改名: - pubspec name: nontonki → fruitshorts(Dart 包名),description 同步;28 个文件的 package: 导入前缀替换 - Android android:label、iOS CFBundleDisplayName/CFBundleName → FruitShorts - 图标资源 assets/icon/nontonki.png → fruitshorts.png(含 pubspec 两处引用) - README 同步(补印尼语说明,顺带修掉写错的模块名 reelshort-app-api → fruitshorts-app-api) 文案: - 三份 arb 的 appName → FruitShorts、brandMark → FRUITSHORTS、shareFooter → FruitShorts(不留 demo 标记) - 新增 lib/l10n/app_id.arb:174 个值键与 en/zh 完全一致,按印尼语习惯翻译(Coin→Koin、Episode→Episode) - 一次性 flutter gen-l10n 生成 app_localizations_id.dart;id 自动进入 supportedLocales,默认 locale 未改 - 新增 test/config/l10n_id_test.dart:钉住 id 文案、supportedLocales 含 id、品牌文案无 demo 标记、占位符渲染 不动:applicationId / bundle id(lumadrama 遗留,等裁定)、目录名、业务逻辑与页面结构、语言选择页(仍只有 en/zh) 门禁:dart analyze lib test 零告警;flutter test 159 全过(基线 155 + 新增 4);残留扫描 0 命中; 三份 arb 键集一致(174/174/174);真机(iPhone iOS 26.6.1)构建安装启动成功,devicectl 列出显示名 FruitShorts
77 lines
2.4 KiB
Dart
77 lines
2.4 KiB
Dart
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:fruitshorts/core/data/remote/api_client.dart';
|
|
import 'package:fruitshorts/core/data/remote/catalog_api.dart';
|
|
|
|
/// 联调测试:直连本机客户端接口服务(8081)。
|
|
/// 服务没启动时自动跳过,不影响日常 `flutter test`。
|
|
void main() {
|
|
final client = ApiClient(baseUrl: 'http://127.0.0.1:8081');
|
|
final api = CatalogApi(client);
|
|
|
|
tearDownAll(client.close);
|
|
|
|
Future<bool> serverUp() async {
|
|
try {
|
|
await api.homeFeed();
|
|
return true;
|
|
} catch (_) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
test('should_parse_banner_and_sections_when_home_feed_is_fetched', () async {
|
|
if (!await serverUp()) {
|
|
markTestSkipped('客户端接口服务未启动,已跳过联调测试');
|
|
return;
|
|
}
|
|
final feed = await api.homeFeed();
|
|
expect(feed.sections, isNotEmpty);
|
|
expect(feed.dramas, isNotEmpty);
|
|
final card = feed.dramas.first;
|
|
expect(card.id, isNotEmpty);
|
|
expect(card.title, isNotEmpty);
|
|
expect(card.posterUrl, startsWith('/files/'));
|
|
});
|
|
|
|
test('should_order_episodes_by_number_and_attach_url_when_detail_is_fetched', () async {
|
|
if (!await serverUp()) {
|
|
markTestSkipped('客户端接口服务未启动,已跳过联调测试');
|
|
return;
|
|
}
|
|
final feed = await api.homeFeed();
|
|
final card = feed.dramas.first;
|
|
final detail = await api.dramaDetail(card.id);
|
|
|
|
expect(detail.id, card.id);
|
|
expect(detail.episodes, isNotEmpty);
|
|
final numbers = detail.episodes.map((episode) => episode.number).toList();
|
|
expect(numbers, orderedEquals([...numbers]..sort()));
|
|
for (final episode in detail.episodes) {
|
|
if (episode.locked) {
|
|
expect(episode.videoUrl, isEmpty);
|
|
} else {
|
|
expect(episode.videoUrl, startsWith('/files/'));
|
|
}
|
|
}
|
|
});
|
|
|
|
test('should_return_play_url_when_episode_is_playable', () async {
|
|
if (!await serverUp()) {
|
|
markTestSkipped('客户端接口服务未启动,已跳过联调测试');
|
|
return;
|
|
}
|
|
final feed = await api.homeFeed();
|
|
final detail = await api.dramaDetail(feed.dramas.first.id);
|
|
final playable = detail.episodes
|
|
.where((episode) => episode.videoUrl.isNotEmpty)
|
|
.toList();
|
|
if (playable.isEmpty) {
|
|
return;
|
|
}
|
|
|
|
final ticket = await api.playTicket(playable.first.id);
|
|
expect(ticket.accessible, isTrue);
|
|
expect(ticket.playUrl, startsWith('/files/'));
|
|
});
|
|
}
|