chore(client): 归档原型阶段新增文件(配置、主题、模型与测试)
为什么:上一批归档只覆盖了「已跟踪文件的修改」,原型阶段新增的文件(app_config、theme、 home_feed/play_ticket 模型、catalog_api、测试目录等)还是未入库状态 —— 而已入库的代码会 import 它们, 留在工作区会导致 HEAD 处的代码编译不过。一并归档,让 HEAD 自洽。 纯归档,无行为改动。
This commit is contained in:
1 parent
e1b98df509
commit
feecc349a0
19 files changed
+2210
No files matched your search
@@ -0,0 +1,76 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:nontonki/core/data/remote/api_client.dart';
|
||||
import 'package:nontonki/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('首页聚合:能解析出轮播与分区', () 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('详情:剧集按下发顺序排列,可播放集带地址', () 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('播放票据:可播放时返回地址', () 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/'));
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user