为什么:上一批归档只覆盖了「已跟踪文件的修改」,原型阶段新增的文件(app_config、theme、 home_feed/play_ticket 模型、catalog_api、测试目录等)还是未入库状态 —— 而已入库的代码会 import 它们, 留在工作区会导致 HEAD 处的代码编译不过。一并归档,让 HEAD 自洽。 纯归档,无行为改动。
61 lines
1.7 KiB
Dart
61 lines
1.7 KiB
Dart
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:nontonki/core/data/models/drama.dart';
|
|
|
|
void main() {
|
|
test('a list card carries one playable preview and the total count', () {
|
|
final drama = Drama.fromCardJson(const {
|
|
'id': 5,
|
|
'title': '闪婚后',
|
|
'synopsis': 'synopsis',
|
|
'cover': '/files/cover.jpg',
|
|
'category': '都市情感',
|
|
'genre': '都市情感',
|
|
'totalEpisodes': 77,
|
|
'isHot': true,
|
|
'viewCount': 3100000,
|
|
'preview': {
|
|
'id': 9,
|
|
'number': 1,
|
|
'title': '第 1 集',
|
|
'isFree': true,
|
|
'playUrl': '/files/episode/9.mp4',
|
|
},
|
|
});
|
|
|
|
expect(drama.detailLoaded, isFalse);
|
|
expect(drama.episodes, hasLength(1));
|
|
expect(drama.episodes.single.videoUrl, '/files/episode/9.mp4');
|
|
expect(drama.episodeCount, 77);
|
|
expect(drama.isHot, isTrue);
|
|
});
|
|
|
|
test('a list card without a playable preview has no episodes', () {
|
|
final drama = Drama.fromCardJson(const {
|
|
'id': 6,
|
|
'title': '替嫁新娘',
|
|
'totalEpisodes': 12,
|
|
});
|
|
|
|
expect(drama.episodes, isEmpty);
|
|
expect(drama.episodeCount, 12);
|
|
});
|
|
|
|
test('a detail response counts the episodes it ships', () {
|
|
final drama = Drama.fromDetailJson(const {
|
|
'id': 5,
|
|
'title': '闪婚后',
|
|
'synopsis': 'synopsis',
|
|
'cover': '/files/cover.jpg',
|
|
'totalEpisodes': 77,
|
|
'episodes': [
|
|
{'id': 9, 'number': 1, 'title': '第 1 集', 'isFree': true},
|
|
{'id': 10, 'number': 2, 'title': '第 2 集', 'isFree': false},
|
|
],
|
|
});
|
|
|
|
expect(drama.detailLoaded, isTrue);
|
|
expect(drama.episodeCount, 77);
|
|
expect(drama.episodes.first.id, '9');
|
|
});
|
|
}
|