@@ -67,6 +67,19 @@ defmodule Algora.BountiesTest do
67
67
installation_id: installation . id
68
68
)
69
69
70
+ claim = Algora.Repo . one ( Algora.Bounties.Claim . preload ( claim . id ) )
71
+
72
+ assert { :ok , _bounty } =
73
+ Algora.Bounties . reward_bounty (
74
+ % {
75
+ owner: owner ,
76
+ amount: ~M[ 4000] usd ,
77
+ bounty_id: bounty . id ,
78
+ claims: [ claim ]
79
+ } ,
80
+ installation_id: installation . id
81
+ )
82
+
70
83
assert { :ok , _stripe_session_url } =
71
84
Algora.Bounties . create_tip (
72
85
% {
@@ -79,22 +92,21 @@ defmodule Algora.BountiesTest do
79
92
claims: [ claim ]
80
93
)
81
94
82
- assert_activity_names ( [ :bounty_posted , :tip_awarded ] )
83
- assert_activity_names_for_user ( creator . id , [ :bounty_posted , :tip_awarded ] )
84
- assert_activity_names_for_user ( recipient . id , [ :tip_awarded ] )
95
+ assert_activity_names ( [ :bounty_posted , :claim_submitted , :bounty_awarded , : tip_awarded] )
96
+ assert_activity_names_for_user ( creator . id , [ :bounty_posted , :bounty_awarded , : tip_awarded] )
97
+ assert_activity_names_for_user ( recipient . id , [ :claim_submitted , : tip_awarded] )
85
98
86
- assert [ _activity , activity ] = Enum . reverse ( Algora.Activities . all ( ) )
99
+ assert [ _bounty , _claim , _awarded , activity ] = Enum . reverse ( Algora.Activities . all ( ) )
87
100
assert "tip_activities" == activity . assoc_name
88
101
assert activity . notify_users == [ recipient . id ]
89
-
90
102
assert activity = Algora.Activities . get_with_preloaded_assoc ( activity . assoc_name , activity . id )
91
103
assert activity . assoc . __meta__ . schema == Algora.Bounties.Tip
92
104
assert activity . assoc . creator . id == creator . id
93
105
end
94
106
95
107
test "query" do
96
- [ bounty | _ ] =
97
- Enum . map ( 1 .. 10 , fn _n ->
108
+ { :ok , bounty } =
109
+ Enum . reduce ( 1 .. 10 , nil , fn _n , _acc ->
98
110
creator = insert! ( :user )
99
111
owner = insert! ( :user )
100
112
_installation = insert! ( :installation , owner: creator )
@@ -111,8 +123,7 @@ defmodule Algora.BountiesTest do
111
123
amount: amount
112
124
}
113
125
114
- { :ok , bounty } = Algora.Bounties . create_bounty ( bounty_params , [ ] )
115
- bounty
126
+ Algora.Bounties . create_bounty ( bounty_params , [ ] )
116
127
end )
117
128
118
129
assert Algora.Bounties . list_bounties (
0 commit comments