feat(player): 点赞与评论改为按集

This commit is contained in:
Zhou Weidong committed 2026-10-21 16:15:29 +08:00
1 parent e6f34977f5
commit 83822a0cbb
25 files changed
+337 -69

No files matched your search

+38
View File
@@ -12,10 +12,12 @@ void main() {
CommentController controller(
FakeCommentRepository comments, {
FakeInteractionRepository? interactions,
String? episodeId,
}) => CommentController(
comments: comments,
interactions: interactions ?? FakeInteractionRepository(),
dramaId: '5',
episodeId: episodeId,
);
test('should_append_next_page_with_cursor_when_has_more_is_true', () async {
@@ -63,6 +65,42 @@ void main() {
model.dispose();
});
test('should_pass_episode_id_to_every_page_and_publish_request', () async {
final root = commentFixture(id: '10', replyCount: 1);
final repository = FakeCommentRepository(
pages: [
CommentPage(
comments: [root],
nextCursor: '10',
hasMore: true,
),
CommentPage(comments: [commentFixture(id: '9')]),
CommentPage(
comments: [commentFixture(id: '11', rootId: '10')],
nextCursor: '11',
hasMore: true,
),
CommentPage(comments: [commentFixture(id: '12', rootId: '10')]),
],
publishResult: commentFixture(id: '13', mine: true),
);
final model = controller(repository, episodeId: 'episode-7');
await model.load();
await model.loadMore();
await model.loadReplies('10');
await model.loadMoreReplies('10');
await model.publish('Nice episode');
expect(
repository.pageCalls.map((call) => call.episodeId),
everyElement('episode-7'),
);
expect(repository.pageCalls, hasLength(4));
expect(repository.publishCalls.single.episodeId, 'episode-7');
model.dispose();
});
test('should_use_server_content_and_pending_status_when_review_is_returned', () async {
final repository = FakeCommentRepository(
publishResult: commentFixture(