fix(player): 收藏与评论数实时刷新

This commit is contained in:
Zhou Weidong committed 2026-10-21 11:39:58 +08:00
1 parent 97bbced02c
commit 5e2b8d9e4d
11 files changed
+275 -29

No files matched your search

+27
View File
@@ -126,4 +126,31 @@ void main() {
'/app/comments/2111012753262120962',
);
});
test('should_parse_numeric_comment_count', () async {
final adapter = FakeHttpAdapter(
(_) async => FakeHttpResponse(envelope(17)),
);
final api = CommentApi(
ApiClient(baseUrl: 'http://127.0.0.1:8081', adapter: adapter),
);
final count = await api.count('5');
expect(count, 17);
expect(adapter.requests.single.method, 'GET');
expect(adapter.requests.single.uri.path, '/app/comments/count');
expect(adapter.requests.single.queryParameters, {'dramaId': '5'});
});
test('should_parse_string_comment_count', () async {
final adapter = FakeHttpAdapter(
(_) async => FakeHttpResponse(envelope('2111012753262120962')),
);
final api = CommentApi(
ApiClient(baseUrl: 'http://127.0.0.1:8081', adapter: adapter),
);
expect(await api.count('5'), 2111012753262120962);
});
}