Add tests for CommentView

This commit is contained in:
krawieck 2020-08-09 21:32:58 +02:00
parent 33a00e0628
commit 6120cb58f7
1 changed files with 38 additions and 3 deletions

View File

@ -45,8 +45,43 @@ void main() {
var comment = CommentView.fromJson(commentFromApi);
print(comment);
expect(14296, comment.id);
expect(8218, comment.creatorId);
expect(comment.id, 14296);
expect(comment.creatorId, 8218);
expect(comment.postId, 38501);
expect(comment.postName, "Niklaus Wirth was right and that is a problem");
expect(comment.parentId, 14286);
expect(comment.content,
"I think that the same functionality current crop of apps has could be implemented much more cleanly and efficiently if there wasn't a rush to get products to market. If developers could spend the time to think things through and try different approaches to see what works best we'd have much higher quality software today. Instead, everything is rushed to market as fast as possible, and developers are constantly overwhelmed with unreasonable amounts of work with no time to do things properly or clean things up along the way.");
expect(comment.removed, false);
expect(comment.read, true);
expect(comment.published, DateTime.parse("2020-08-02T20:31:19.303284"));
expect(comment.updated, null);
expect(comment.deleted, false);
expect(comment.apId, "https://dev.lemmy.ml/comment/14296");
expect(comment.local, true);
expect(comment.communityId, 14680);
expect(comment.communityActorId, "https://dev.lemmy.ml/c/programming");
expect(comment.communityLocal, true);
expect(comment.communityName, "programming");
expect(comment.communityIcon, null);
expect(comment.banned, false);
expect(comment.bannedFromCommunity, false);
expect(comment.creatorActorId, "https://dev.lemmy.ml/u/yogthos");
expect(comment.creatorLocal, true);
expect(comment.creatorName, "yogthos");
expect(comment.creatorPreferredUsername, null);
expect(
comment.creatorPublished, DateTime.parse("2020-01-18T04:02:39.254957"));
expect(
comment.creatorAvatar, "https://dev.lemmy.ml/pictrs/image/bwk1q2.png");
expect(comment.score, 1);
expect(comment.upvotes, 1);
expect(comment.downvotes, 0);
expect(comment.hotRank, 0);
expect(comment.hotRankActive, 0);
expect(comment.userId, 13709);
expect(comment.myVote, 0);
expect(comment.subscribed, false);
expect(comment.saved, false);
});
}