Tests - operation in Hive - vote
Operation: vote_operation, // 0
Test cases - voting/downvoting before paid out
Test cases
-
1. User votes for the own post. -
2. User votes for the someone else's post.
Preconditions (test 1 and 2):
- There are users A and B.
- User A creates a post.
Steps:
Step 1:
(test 1): User A votes for a post.
(test 2): User B votes for a post.
Expected results:
- After operation: The vote is added.
- After operation: RC is reduced.
- After operation: The voting power is reduced.
- After operation: The virtual operation:
effective_comment_vote_operation
is generated.
Test cases
-
3. User votes for the own comment. -
4. User votes for the someone else's comment.
Preconditions (test 3 and 4):
- There are users A, B and C.
- User C creates a post.
- User A comments on a post.
Steps:
Step 1:
(test 3): User A votes for a comment.
(test 4): User B votes for a comment.
Expected results:
- After operation: The vote is added.
- After operation: RC is reduced.
- After operation: The voting power is reduced.
- After operation: The virtual operation:
effective_comment_vote_operation
is generated.
Test cases
-
5. User downvotes for the own post. -
6. User downvotes for the someone else's post.
Preconditions (test 5 and 6):
- There are users A and B.
- User A creates a post.
Steps:
Step 1:
(test 5): User A downvotes for a post. (I think it strange, but possible)
(test 6): User B downvotes for a post.
Expected results:
- After operation: The downvote is added.
- After operation: RC is reduced.
- After operation: The downvoting power is reduced.
- After operation: The virtual operation:
effective_comment_vote_operation
is generated.
Test cases
-
7. User downvotes for the own comment. -
8. User downvotes for the someone else's comment.
Preconditions (test 7 and 8):
- There are users A, B and C.
- User C creates a post.
- User A comments on a post.
Steps:
Step 1:
(test 7): User A downvotes for a comment.
(test 8): User B downvotes for a comment.
Expected results:
- After operation: The downvote is added.
- After operation: RC is reduced.
- After operation: The downvoting power is reduced.
- After operation: The virtual operation:
effective_comment_vote_operation
is generated.
Test cases
-
9. User votes two times (the second vote has a higher weight) for the own post. -
10. User votes two times (the second vote has a lower weight) for the own post. -
11. User votes two times (the second vote weight = 0) for the own post. -
12. User votes two times (the second vote has a higher weight) for the the someone else's post. -
13. User votes two times (the second vote has a lower weight) for the the someone else's post. -
14. User votes two times (the second vote weight = 0) for the the someone else's post.
Remark:
Voting second time for the same a post/comment is a vote edit.
Preconditions (test 9, 10, 11, 12, 13 and 14):
- There are users A and B.
- User A creates a post.
Steps:
Step 1
(test 9, 10, 11): User A votes for a post.
(test 12, 13, 14): User B votes for a post.
Expected results:
- After operation: The vote is added.
- After operation: RC is reduced.
- After operation: The voting power is reduced.
- After operation: The virtual operation:
effective_comment_vote_operation
is generated.
Steps:
Step 2
(test 9): User A increases the weight of his vote for a post.
(test 10): User A decreases the weight of his vote for a post.
(test 11): User A updates the weight to 0.
(test 12): User B increases the weight of his vote for a post.
(test 13): User B decreases the weight of his vote for a post.
(test 14): User B updates the weight to 0.
Expected results:
- After operation: The vote is updated.
- After operation: RC is reduced.
- After operation:
- (test 9, 10, 12, 13) The voting power is reduced.
- (test 11, 14) The voting power is not reduced.
- After operation: The virtual operation:
effective_comment_vote_operation
is generated.
Test cases
-
15. User votes two times (the second vote has a higher weight) for the own comment. -
16. User votes two times (the second vote has a lower weight) for the own comment. -
17. User votes two times (the second vote weight = 0) for the own comment. -
18. User votes two times (the second vote has a higher weight) for the the someone else's comment. -
19. User votes two times (the second vote has a lower weight) for the the someone else's comment. -
20. User votes two times (the second vote weight = 0) for the the someone else's comment.
Remark:
Voting second time for the same a post/comment is a vote edit.
Preconditions (test 15, 16, 17, 18, 19 and 20):
- There are users A, B and C.
- User C creates a post.
- User A comments on a post.
Steps:
Step 1
(test 15, 16, 17): User A votes for a comment.
(test 18, 19, 20): User B votes for a comment.
Expected results:
- After operation: The vote is added.
- After operation: RC is reduced.
- After operation: The voting power is reduced.
- After operation: The virtual operation:
effective_comment_vote_operation
is generated.
Steps:
Step 2
(test 15): User A increases the weight of his vote for a comment.
(test 16): User A decreases the weight of his vote for a comment.
(test 17): User A updates the weight to 0.
(test 18): User A increases the weight of his vote for a comment.
(test 19): User B decreases the weight of his vote for a comment.
(test 20): User B updates the weight to 0.
Expected results:
- After operation: The vote is updated.
- After operation: RC is reduced.
- After operation:
- (test 15, 16, 18, 19) The voting power is reduced
- (test 17, 20) The voting power is not reduced.
- After operation: The virtual operation:
effective_comment_vote_operation
is generated.
Test cases
-
21. User downvotes two times (the second downvote has a higher weight) for the own post. -
22. User downvotes two times (the second downvote has a lower weight) for the own post. -
23. User downvotes two times (the second vote weight = 0) for the own post. -
24. User downvotes two times (the second downvote has a higher weight) for the the someone else's post. -
25. User downvotes two times (the second downvote has a lower weight) for the the someone else's post. -
26. User downvotes two times (the second vote weight = 0) for the the someone else's post.
Remark:
Voting second time for the same a post/comment is a vote edit.
Preconditions (test 21-26):
- There are users A and B.
- User A creates a post.
Steps:
Step 1
(test 21, 22, 23): User A downvotes for a post.
(test 24, 25, 26): User B downvotes for a post.
Expected results:
- After operation: The downvote is added.
- After operation: RC is reduced.
- After operation: The downvoting power is reduced.
- After operation: The virtual operation:
effective_comment_vote_operation
is generated.
Steps:
Step 2
(test 21): User A increases the weight of his downvote for a post.
(test 22): User A decreases the weight of his downvote for a post.
(test 23): User A updates the weight to 0.
(test 24): User B increases the weight of his downvote for a post.
(test 25): User B decreases the weight of his downvote for a post.
(test 26): User B updates the weight to 0.
Expected results:
- After operation: The downvote is updated.
- After operation: RC is reduced.
- After operation:
- (test 21, 22, 24, 25) The downvoting power is reduced
- (test 23, 26) The downvoting power is not reduced
- After operation: The virtual operation:
effective_comment_vote_operation
is generated.
Test cases
-
27. User downvotes two times (the second downvote has a higher weight) for the own comment. -
28. User downvotes two times (the second downvote has a lower weight) for the own comment. -
29. User downvotes two times (the second vote weight = 0) for the own comment. -
30. User downvotes two times (the second downvote has a higher weight) for the the someone else's comment. -
31. User downvotes two times (the second downvote has a lower weight) for the the someone else's comment. -
32. User downvotes two times (the second vote weight = 0) for the the someone else's comment.
Remark:
Voting second time for the same a post/comment is a vote edit.
Preconditions (test 27-32):
- There are users A, B and C.
- User C creates a post.
- User A comments on a post.
Steps:
Step 1
(test 27, 28, 29): User A downvotes for a comment.
(test 30, 31, 32): User B downvote for a comment.
Expected results:
- After operation: The downvote is added.
- After operation: RC is reduced.
- After operation: The downvoting power is reduced.
- After operation: The virtual operation:
effective_comment_vote_operation
is generated.
Steps:
Step 2
(test 27): User A increases the weight of his downvote for a comment.
(test 28): User A decreases the weight of his downvote for a comment.
(test 29): User A updates the weight to 0.
(test 30): User B increases the weight of his downvote for a comment.
(test 31): User B decreases the weight of his downvote for a comment.
(test 32): User B updates the weight to 0.
Expected results:
- After operation: The downvote is updated.
- After operation: RC is reduced.
- After operation:
- (test 27, 28, 30, 31) The downvoting power is reduced
- (test 29, 32) The downvoting power is reduced
- After operation: The virtual operation:
effective_comment_vote_operation
is generated.
Test cases
-
33. User votes and later downvotes for the own post. -
34. User votes and later downvotes for the the someone else's post.
Remark:
Voting second time for the same a post/comment is a vote edit.
Preconditions (test 33, 34):
- There are users A and B.
- User A creates a post.
Steps:
Step 1
(test 33): User A votes for a post.
(test 34): User B votes for a post.
Expected results:
- After operation: The vote is added.
- After operation: RC is reduced.
- After operation: The voting power is reduced.
- After operation: The virtual operation:
effective_comment_vote_operation
is generated.
Steps:
Step 2
(test 33): User A decreases the weight of his vote for a post - makes downvote.
(test 34): User B decreases the weight of his vote for a post - makes downvote.
Expected results:
- After operation: The downvote is updated.
- After operation: RC is reduced.
- After operation: The downvoting power is reduced.
- After operation: The virtual operation:
effective_comment_vote_operation
is generated.
Test cases
-
35. User votes and later downvotes for the own comment. -
36. User votes and later downvotes for the the someone else's comment.
Preconditions (test 35, 36):
- There are users A, B and C.
- User C creates a post.
- User A comments on a post.
Steps:
Step 1
(test 35): User A votes for a comment.
(test 36): User B votes for a comment.
Expected results:
- After operation: The vote is added.
- After operation: RC is reduced.
- After operation: The voting power is reduced.
- After operation: The virtual operation:
effective_comment_vote_operation
is generated.
Steps:
Step 2
(test 35): User A decreases the weight of his vote for a post - makes downvote.
(test 36): User B decreases the weight of his vote for a post - makes downvote.
Expected results:
- After operation: The downvote is updated.
- After operation: RC is reduced.
- After operation: The downoting power is reduced.
- After operation: The virtual operation:
effective_comment_vote_operation
is generated.
Test cases
-
37. User downvotes and later votes for the own post. -
38. User downvotes and later votes for the the someone else's post.
Remark:
Voting second time for the same a post/comment is a vote edit.
Preconditions (test 33, 34):
- There are users A and B.
- User A creates a post.
Steps:
Step 1
(test 37): User A downvotes for a post.
(test 38): User B downvotes for a post.
Expected results:
- After operation: The downvote is added.
- After operation: RC is reduced.
- After operation: The downvoting power is reduced.
- After operation: The virtual operation:
effective_comment_vote_operation
is generated.
Steps:
Step 2
(test 37): User A increases the weight of his vote for a post - makes nvote.
(test 38): User B increases the weight of his vote for a post - makes vote.
Expected results:
- After operation: The vote is updated.
- After operation: RC is reduced.
- After operation: The voting power is reduced.
- After operation: The virtual operation:
effective_comment_vote_operation
is generated.
Test cases
-
39. User downvotes and later votes for the own comment. -
40. User downvotes and later votes for the the someone else's comment.
Preconditions (test 39, 40):
- There are users A, B and C.
- User C creates a post.
- User A comments on a post.
Steps:
Step 1
(test 39): User A downvotes for a comment.
(test 40): User B downvotes for a comment.
Expected results:
- After operation: The downvote is added.
- After operation: RC is reduced.
- After operation: The downvoting power is reduced.
- After operation: The virtual operation:
effective_comment_vote_operation
is generated.
Steps:
Step 2
(test 39): User A increases the weight of his vote for a post - makes vote.
(test 40): User B increases the weight of his vote for a post - makes vote.
Expected results:
- After operation: The vote is updated.
- After operation: RC is reduced.
- After operation: The voting power is reduced.
- After operation: The virtual operation:
effective_comment_vote_operation
is generated.
Test cases
-
41. The author reputation is reduced, when the post is downvoted by the user with the higher reputation.
Preconditions (test 41):
- There are users A and B, the user B has higher reputation than the user A.
- User A creates a post.
Steps:
Step 1
User B downvotes for a post.
Expected results:
- After operation: The downvote is added.
- After operation: RC is reduced.
- After operation: The downvoting power is reduced.
- After operation: The virtual operation:
effective_comment_vote_operation
is generated. - After operation: The reputation of the user A is decreased.
-
42. The author reputation is reduced, when the comment is downvoted by the user with the higher reputation.
Preconditions (test 42):
- There are users A, B and C. The user B has higher reputation than the user A.
- User C creates a post.
- User A comments on the post.
Steps:
Step 1
User B downvotes for a comment.
Expected results:
- After operation: The downvote is added.
- After operation: RC is reduced.
- After operation: The downvoting power is reduced.
- After operation: The virtual operation:
effective_comment_vote_operation
is generated. - After operation: The reputation of the user A is decreased.
Test case - voting/downvoting when allow_votes = false
Test cases
-
43. User votes for a post which has allow_votes = false before paying out.
Preconditions (test 43):
- There are users A and B.
- User A creates a post.
Steps:
Step 1
(test 43): User B votes for a post.
Expected results:
- After operation: The vote is not added - the error is generated.
- After operation: RC is not reduced.
- After operation: The voting power is not reduced.
- After operation: The virtual operation:
effective_comment_vote_operation
is not generated.
Test cases
-
44. User downvotes for a post which has allow_votes = false before paying out.
Preconditions (test 43):
- There are users A and B.
- User A creates a post.
Steps:
Step 1
(test 44): User B dowvotes for a post.
Expected results:
- After operation: The downvote is added.
- After operation: RC is reduced.
- After operation: The downvoting power is reduced.
- After operation: The virtual operation:
effective_comment_vote_operation
is generated.
Test cases
-
45. User votes for a comment which has allow_votes = false before paying out.
Preconditions (test 45):
- There are users A, B and C.
- User C creates a post.
- User A comments on the post.
Steps:
Step 1
User B votes for a comment.
Expected results:
- After operation: The vote is not added - the error is generated.
- After operation: RC is not reduced.
- After operation: The voting power is not reduced.
- After operation: The virtual operation:
effective_comment_vote_operation
is not generated.
Test cases
-
46. User downvotes for a comment which has allow_votes = false before paying out.
Preconditions (test 46):
- There are users A, B and C.
- User C creates a post.
- User A comments on the post.
Steps:
Step 1
User B votes for a comment.
Expected results:
- After operation: The downvote is added.
- After operation: RC is reduced.
- After operation: The downvoting power is reduced.
- After operation: The virtual operation:
effective_comment_vote_operation
is generated.
Test cases
-
47. User votes for a post which has allow_votes = false after paying out.
Preconditions (test 47):
- There are users A and B.
- User A creates a post.
- The reward for the post is already paid.
Steps:
Step 1
User B votes for a post.
Expected results:
- After operation: The vote is added.
- After operation: RC is reduced.
- After operation: The voting power is not reduced.
- After operation: The virtual operation:
effective_comment_vote_operation
is not generated.
Test cases
-
48. User downvotes for a post which has allow_votes = false after paying out.
Preconditions (test 48):
- There are users A and B.
- User A creates a post.
- The reward for the post is already paid.
Steps:
Step 1
User B dowvotes for a post.
Expected results:
- After operation: The downvote is added.
- After operation: RC is reduced.
- After operation: The downvoting power is not reduced.
- After operation: The virtual operation:
effective_comment_vote_operation
is not generated.
Test cases
-
49. User votes for a comment which has allow_votes = false after paying out.
Preconditions (test 49):
- There are users A, B and C.
- User C creates a post.
- User A comments on the post.
- The reward for the comment is already paid.
Steps:
Step 1
User B votes for a comment.
Expected results:
- After operation: The vote is added.
- After operation: RC is reduced.
- After operation: The voting power is not reduced.
- After operation: The virtual operation:
effective_comment_vote_operation
is not generated.
Test cases
-
50. User downvotes for a comment which has allow_votes = false after paying out.
Preconditions (test 50):
- There are users A, B and C.
- User C creates a post.
- User A comments on the post.
- The reward for the comment is already paid.
Steps:
Step 1
User B votes for a comment.
Expected results:
- After operation: The downvote is added.
- After operation: RC is reduced.
- After operation: The downvoting power is not reduced.
- After operation: The virtual operation:
effective_comment_vote_operation
is not generated.
Test cases - voting/downvoting after paid out.
Test cases
-
51. User votes for the own post after paid out. -
52. User votes for the someone else's post after paid out.
Preconditions (test 51 and 52):
- There are users A and B.
- User A creates a post.
- The post is already paid out.
Steps:
Step 1:
(test 51): User A votes for a post.
(test 52): User B votes for a post.
Expected results:
- After operation: The vote is added.
- After operation: RC is reduced.
- After operation: The voting power is not reduced.
- After operation: The virtual operation:
effective_comment_vote_operation
is not generated.
Test cases
-
53. User votes for the own comment. -
54. User votes for the someone else's comment.
Preconditions (test 53 and 54):
- There are users A, B and C.
- User C creates a post.
- User A comments on a post.
- The comment is already paid out.
Steps:
Step 1:
(test 3): User A votes for a comment.
(test 4): User B votes for a comment.
Expected results:
- After operation: The vote is added.
- After operation: RC is reduced.
- After operation: The voting power is not reduced.
- After operation: The virtual operation:
effective_comment_vote_operation
is not generated.
Test cases
-
55. User downvotes for the own post. -
56. User downvotes for the someone else's post.
Preconditions (test 55 and 56):
- There are users A and B.
- User A creates a post.
- The post is already paid out.
Steps:
Step 1:
(test 55): User A downvotes for a post.
(test 56): User B downvotes for a post.
Expected results:
- After operation: The downvote is added.
- After operation: RC is reduced.
- After operation: The downvoting power is not reduced.
- After operation: The virtual operation:
effective_comment_vote_operation
is not generated.
Test cases
-
57. User downvotes for the own comment. -
58. User downvotes for the someone else's comment.
Preconditions (test 57 and 58):
- There are users A, B and C.
- User C creates a post.
- User A comments on a post.
- The comment is already paid out.
Steps:
Step 1:
(test 57): User A downvotes for a comment.
(test 58): User B downvotes for a comment.
Expected results:
- After operation: The downvote is added.
- After operation: RC is reduced.
- After operation: The downvoting power is not reduced.
- After operation: The virtual operation:
effective_comment_vote_operation
is not generated.
Test cases
-
59. The author reputation is not reduced, when the post is downvoted by the user with the higher reputation after paid out.
Preconditions (test 59):
- There are users A and B, the user B has higher reputation than the user A.
- User A creates a post.
- The post is already paid out.
Steps:
Step 1
User B downvotes for a post.
Expected results:
- After operation: The downvote is added.
- After operation: RC is reduced.
- After operation: The downvoting power is not reduced.
- After operation: The virtual operation:
effective_comment_vote_operation
is not generated. - After operation: The reputation of the user A is not decreased.
-
60. The author reputation is not reduced, when the comment is downvoted by the user with the higher reputation after paid out.
Preconditions (test 60):
- There are users A, B and C. The user B has higher reputation than the user A.
- User C creates a post.
- User A comments on the post.
- The comment is already paid out.
Steps:
Step 1
User B downvotes for a comment.
Expected results:
- After operation: The downvote is added.
- After operation: RC is reduced.
- After operation: The downvoting power is not reduced.
- After operation: The virtual operation:
effective_comment_vote_operation
is not generated. - After operation: The reputation of the user A is not decreased.
Remark:
The tests for votes are also in the issue about calculating rewards.