fix(profile): 修复我的收藏与观看历史列表不显示
This commit is contained in:
1 parent
f2ae0c70b6
commit
a48433f01d
6 files changed
+202
-12
No files matched your search
@@ -50,4 +50,52 @@ void main() {
|
||||
expect(page.list.single.episodeNumber, 6);
|
||||
expect(page.list.single.totalEpisodes, 68);
|
||||
});
|
||||
|
||||
test('should_parse_recent_when_server_returns_legacy_list', () async {
|
||||
final adapter = FakeHttpAdapter(
|
||||
(_) async => FakeHttpResponse(
|
||||
jsonEncode({
|
||||
'code': 0,
|
||||
'message': 'ok',
|
||||
'data': [
|
||||
{
|
||||
'dramaId': '5',
|
||||
'episodeId': '7',
|
||||
'positionMs': '203904',
|
||||
'durationMs': '227882',
|
||||
'finished': false,
|
||||
'playCount': 8,
|
||||
'updatedAt': '2026-10-21T15:17:05.419',
|
||||
},
|
||||
],
|
||||
}),
|
||||
),
|
||||
);
|
||||
final api = WatchApi(
|
||||
ApiClient(baseUrl: 'http://127.0.0.1:8081', adapter: adapter),
|
||||
);
|
||||
|
||||
final page = await api.recent();
|
||||
|
||||
expect(page.total, 1);
|
||||
expect(page.list.single.dramaId, '5');
|
||||
expect(page.list.single.episodeId, '7');
|
||||
expect(page.list.single.position.inMilliseconds, 203904);
|
||||
});
|
||||
|
||||
test('should_return_empty_recent_when_data_is_null', () async {
|
||||
final adapter = FakeHttpAdapter(
|
||||
(_) async => FakeHttpResponse(
|
||||
jsonEncode({'code': 0, 'message': 'ok', 'data': null}),
|
||||
),
|
||||
);
|
||||
final api = WatchApi(
|
||||
ApiClient(baseUrl: 'http://127.0.0.1:8081', adapter: adapter),
|
||||
);
|
||||
|
||||
final page = await api.recent();
|
||||
|
||||
expect(page.total, 0);
|
||||
expect(page.list, isEmpty);
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user